本文整理汇总了C++中Triangle::SetShader方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle::SetShader方法的具体用法?C++ Triangle::SetShader怎么用?C++ Triangle::SetShader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangle
的用法示例。
在下文中一共展示了Triangle::SetShader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Sphere
Scene::Scene()
: m_AmbientLight(0)
{
#if 0
#if 1
for (int i=0; i < 100; i++) {
DefaultShader *ds = new DefaultShader;
Sphere *s = new Sphere(Vector3d(Libvec::Random(-50, 50), Libvec::Random(-50, 50), Libvec::Random(-50, 50)), Libvec::Random(1, 20));
ds->SetDiffuseColor(colorf::RandColor());
ds->SetShinyness(0.0f);
s->SetShader(ShaderPtr(ds));
s->Prepare();
m_DrawableList.push_back(s);
}
#endif
Sphere *s = new Sphere(Vector3d(0.0, 0.0, 0.0), 50.0);
{
DefaultShader *ds = new DefaultShader;
ds->SetShinyness(0.0f);
s->SetShader(ShaderPtr(ds));
s->Prepare();
}
m_DrawableList.push_back(s);
Plane *p = new Plane(Ray(Vector3d(0.0, 0.0, -50.0), Vector3d(0.0, 0.0, 1.0)));
{
DefaultShader *ds = new DefaultShader;
ds->SetShinyness(0.2f);
p->SetShader(ShaderPtr(ds));
p->Prepare();
}
m_DrawableList.push_back(p);
p = new Plane(Ray(Vector3d(-50.0, 0.0, 0.0), Vector3d(1.0, 0.0, 0.0)));
{
DefaultShader *ds = new DefaultShader;
ds->SetShinyness(0.0f);
p->SetShader(ShaderPtr(ds));
p->Prepare();
}
m_DrawableList.push_back(p);
m_SimpleLightList.push_back(new SimpleLight(Vector3d(0.0, 0.0, 100.0), colorf(1.0, 0.0, 0.0), 100));
m_SimpleLightList.push_back(new SimpleLight(Vector3d(100.0, 0.0, 5.0), colorf(0.0, 1.0, 0.0), 100));
m_SimpleLightList.push_back(new SimpleLight(Vector3d(0.0, 100.0, 5.0), colorf(0.0, 0.0, 1.0), 100));
m_SimpleLightList.push_back(new SimpleLight(Vector3d(0.0, 60.0, 60.0), colorf(1.0, 1.0, 1.0), 100));
#endif
#if 0
m_AmbientLight = colorf(0.0f, 0.0f, 0.0f);
{
Sphere *s = new Sphere(Vector3d(10.0, 10.0, 10.0), 8.0);
{
DefaultShader *ds = new DefaultShader;
ds->SetShinyness(0.8f);
s->SetShader(ShaderPtr(ds));
s->Prepare();
}
m_DrawableList.push_back(s);
}
// bottom
{
Plane *p = new Plane(Ray(Vector3d(0.0, 0.0, 0.0), Vector3d(0.0, 0.0, 1.0)));
DefaultShader *ds = new DefaultShader;
ds->SetDiffuseColor(colorf(1.0, 0.2, 0.2));
ds->SetShinyness(0.5f);
p->SetShader(ShaderPtr(ds));
p->Prepare();
m_DrawableList.push_back(p);
}
{
Plane *p = new Plane(Ray(Vector3d(0.0, 0.0, 0.0), Vector3d(0.0, 1.0, 0.0)));
DefaultShader *ds = new DefaultShader;
ds->SetDiffuseColor(colorf(0.2, 1.0, 0.2));
ds->SetShinyness(0.5f);
p->SetShader(ShaderPtr(ds));
p->Prepare();
m_DrawableList.push_back(p);
}
// back
{
Plane *p = new Plane(Ray(Vector3d(0.0, 0.0, 0.0), Vector3d(1.0, 0.0, 0.0)));
DefaultShader *ds = new DefaultShader;
ds->SetDiffuseColor(colorf(0.2, 0.2, 1.0));
ds->SetShinyness(0.5f);
p->SetShader(ShaderPtr(ds));
p->Prepare();
m_DrawableList.push_back(p);
}
// m_SimpleLightList.push_back(new SimpleLight(Vector3d(1.0, 1.0, 100.0), colorf(1.0, 0.0, 0.0), 100));
// m_SimpleLightList.push_back(new SimpleLight(Vector3d(100.0, 1.0, 5.0), colorf(0.0, 1.0, 0.0), 100));
// m_SimpleLightList.push_back(new SimpleLight(Vector3d(1.0, 100.0, 5.0), colorf(0.0, 0.0, 1.0), 100));
m_SimpleLightList.push_back(new SimpleLight(Vector3d(20.0, 10.0, 20), colorf(1.0, 1.0, 1.0), 100));
#endif
#if 1
m_AmbientLight = colorf(0.0f, 0.0f, 0.2f);
if (0) {
//.........这里部分代码省略.........