Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Version

HPS 2022

Language

C++

Description:

void CHPSView::OnUserCode()
{
	HPS::SegmentKey modelKey = GetCanvas().GetFrontView().GetAttachedModel().GetSegmentKey();
	ImageKit imageKit;
	
	UTF8 file_in = "zebra.jpg";
	Image::ImportOptionsKit importOptionsKit;
	importOptionsKit.SetFormat(Image::Format::Jpeg);
	imageKit = Image::File::Import(static_cast<const char*>(file_in), importOptionsKit);

	PortfolioKeyArray portfolios;
	PortfolioKey pKey;
	ImageDefinition imageDefinition;
	TextureOptionsKit textureOptionsKit;

	modelKey.GetPortfolioControl().Show(portfolios);
	pKey = portfolios[0];
	imageDefinition = pKey.DefineImage("zebra_texture", imageKit);

	textureOptionsKit.SetParameterizationSource(Material::Texture::Parameterization::ReflectionVector);
	pKey.DefineTexture("zebra", imageDefinition, textureOptionsKit);

	HPS::SegmentKey mySegmentKey = modelKey.Subsegment("geometry");
	HPS::CylinderKey cylinderKey = mySegmentKey.InsertCylinder(
		Point(5, 5, 10),  Point(-7, -5, -10), 5, 
		HPS::Cylinder::Capping::Both);

	HPS::SegmentKey segKey = mySegmentKey;

	segKey.GetMaterialMappingControl()
		.SetFaceTexture("zebra", Material::Texture::Channel::EnvironmentTexture);

	GetCanvas().Update();
}

  • No labels