本文整理汇总了C++中osg::PointLightRecPtr::setBeacon方法的典型用法代码示例。如果您正苦于以下问题:C++ PointLightRecPtr::setBeacon方法的具体用法?C++ PointLightRecPtr::setBeacon怎么用?C++ PointLightRecPtr::setBeacon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::PointLightRecPtr
的用法示例。
在下文中一共展示了PointLightRecPtr::setBeacon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doMain
// Initialize GLUT & OpenSG and set up the scene
int doMain(int argc, char **argv)
{
printf("Press key '1', '2', or '3' to toggle the light sources.\n");
// OSG init
OSG::osgInit(argc,argv);
// GLUT init
int winid = setupGLUT(&argc, argv);
// the connection between GLUT and OpenSG
OSG::GLUTWindowUnrecPtr gwin= OSG::GLUTWindow::create();
gwin->setGlutId(winid);
gwin->setSize( 800, 800 );
gwin->init();
// Create the shader material
OSG::ChunkMaterialUnrecPtr cmat = OSG::ChunkMaterial::create();
OSG::MaterialChunkUnrecPtr matc = OSG::MaterialChunk::create();
matc->setAmbient(OSG::Color4f(0.1f, 0.1f, 0.1f, 1.0f));
matc->setDiffuse(OSG::Color4f(0.3f, 0.3f, 0.3f, 1.0f));
matc->setSpecular(OSG::Color4f(0.8f, 0.8f, 0.8f, 1.0f));
matc->setShininess(100);
matc->setLit(true);
OSG::ShaderProgramChunkUnrecPtr shl = OSG::ShaderProgramChunk::create();
OSG::ShaderProgramUnrecPtr shl_vp =
OSG::ShaderProgram::createVertexShader();
shl_vp->setProgram(_vp_program);
shl->addShader(shl_vp);
OSG::ShaderProgramUnrecPtr shl_fp =
OSG::ShaderProgram::createFragmentShader();
shl_fp->setProgram(_fp_program);
shl->addShader(shl_fp);
shl_vp->addProceduralVariable ("Light0Active", &light0Active);
shl_vp->addProceduralVariable ("Light1Active", &light1Active);
shl_vp->addNodeProceduralVariable("Light2Active", &light2Active);
cmat->addChunk(matc);
cmat->addChunk(shl);
// create root node
_scene = OSG::Node::create();
// create two light sources.
OSG::TransformUnrecPtr point1_trans;
OSG::NodeUnrecPtr point1 =
OSG::makeCoredNode<OSG::PointLight>(&_point1_core);
point1_beacon = OSG::makeCoredNode<OSG::Transform >(&point1_trans);
point1_trans->editMatrix().setTranslate(-10.0, 5.0, 5.0);
_point1_core->setAmbient(0.0f, 0.0f, 0.0f , 1.0f);
_point1_core->setDiffuse(1.0f, 0.0f, 0.0f, 1.0f);
_point1_core->setSpecular(1.0f, 1.0f, 1.0f, 1.0f);
_point1_core->setBeacon(point1_beacon);
_point1_core->setOn(true);
OSG::TransformUnrecPtr point2_trans;
OSG::NodeUnrecPtr point2 =
OSG::makeCoredNode<OSG::PointLight>(&_point2_core);
point2_beacon = OSG::makeCoredNode<OSG::Transform >(&point2_trans);
point2_trans->editMatrix().setTranslate(10.0, 5.0, 5.0);
_point2_core->setAmbient(0.0f, 0.0f, 0.0f, 1.0f);
_point2_core->setDiffuse(0.0f, 1.0f, 0.0f, 1.0f);
_point2_core->setSpecular(1.0f, 1.0f, 1.0f, 1.0f);
_point2_core->setBeacon(point2_beacon);
_point2_core->setOn(true);
point1->addChild(point2);
OSG::TransformUnrecPtr point3_trans;
OSG::NodeUnrecPtr point3 =
OSG::makeCoredNode<OSG::PointLight>(&_point3_core);
point3_beacon = OSG::makeCoredNode<OSG::Transform >(&point3_trans);
point3_trans->editMatrix().setTranslate(0.0, -12.0, 5.0);
_point3_core->setAmbient(0.0f, 0.0f, 0.0f, 1.0f);
_point3_core->setDiffuse(0.5f, 0.0f, 1.0f, 1.0f);
_point3_core->setSpecular(1.0f, 1.0f, 1.0f, 1.0f);
//.........这里部分代码省略.........