当前位置: 首页>>代码示例>>C++>>正文


C++ Primitive::SetIsLight方法代码示例

本文整理汇总了C++中Primitive::SetIsLight方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::SetIsLight方法的具体用法?C++ Primitive::SetIsLight怎么用?C++ Primitive::SetIsLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Primitive的用法示例。


在下文中一共展示了Primitive::SetIsLight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Setup

void Scene::Setup(params::InterfaceGlRef _params) {
	Primitive* primitive;
	float planeDist = 25;
	//ground plane
	primitive = new PlanePrimitive(ci::Vec3f(0, -planeDist, 0), ci::Vec3f(0, 1, 0));
	primitive->SetName("GroundPlane");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(1.0f, 0.2f, 0.2f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	m_primitives.push_back(primitive);
	//top plane
	primitive = new PlanePrimitive(ci::Vec3f(0, planeDist, 0), ci::Vec3f(0, -1, 0));
	primitive->SetName("TopPlane");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(0.2f, 1.0f, 0.2f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	m_primitives.push_back(primitive);

	//side plane
	primitive = new PlanePrimitive(ci::Vec3f(planeDist, 0, 0), ci::Vec3f(-1, 0, 0));
	primitive->SetName("RightPlane");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(0.2f, 0.2f, 1.0f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	m_primitives.push_back(primitive);
	//side plane
	primitive = new PlanePrimitive(ci::Vec3f(-planeDist, 0, 0), ci::Vec3f(1, 0, 0));
	primitive->SetName("LeftPlane");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(1.0f, 1.0f, 0.2f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	m_primitives.push_back(primitive);

	//side plane
	primitive = new PlanePrimitive(ci::Vec3f(0, 0, planeDist), ci::Vec3f(0, 0, -1));
	primitive->SetName("FrontPlane");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(1.0f, 0.2f, 1.0f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	m_primitives.push_back(primitive);
	//side plane
	primitive = new PlanePrimitive(ci::Vec3f(0, 0, -planeDist), ci::Vec3f(0, 0, 1));
	primitive->SetName("BackPlane");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(0.2f, 1.0f, 1.0f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	m_primitives.push_back(primitive);


	//big sphere
	primitive = new SpherePrimitive(ci::Vec3f(5, 7, 0), 7);
	primitive->SetName("BigSphere");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	primitive->GetMaterial().SetReflectionCoefficient(0.0f);
	primitive->GetMaterial().SetRefractionCoefficient(1.1f);
	m_primitives.push_back(primitive);
	//small sphere
	primitive = new SpherePrimitive(ci::Vec3f(-5, -5, -10), 5);
	primitive->SetName("SmallSphere");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(0.5f, 0.5f, 0.1f));
	primitive->GetMaterial().SetSpecularColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->GetMaterial().SetDiffuseCoefficient(1.0f);
	primitive->GetMaterial().SetSpecularCoefficient(0.0f);
	primitive->GetMaterial().SetReflectionCoefficient(0.1f);
	primitive->GetMaterial().SetRefractionCoefficient(0.0f);
	m_primitives.push_back(primitive);
	//light1
	primitive = new SpherePrimitive(ci::Vec3f(10, 24, 0), 2);
	primitive->SetName("Light1");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(1.0f, 1.0f, 1.0f));
	primitive->SetIsLight(true);
	m_primitives.push_back(primitive);
	////light2
	/*primitive = new SpherePrimitive(ci::Vec3f(-10, 10, -10), 1);
	primitive->SetName("Light 2");
	primitive->GetMaterial().SetDiffuseColor(ci::ColorA(0.7f, 0.7f, 0.7f));
	primitive->SetIsLight(true);
	m_primitives.push_back(primitive);*/

	for (int i=0; i<m_primitives.size(); i++)
		m_primitives[i]->AddParams(_params);	
}
开发者ID:akshayloke,项目名称:RayTracer,代码行数:91,代码来源:Scene.cpp


注:本文中的Primitive::SetIsLight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。