| | 406 | |
| | 407 | stateset->addUniform(position_Uniform); // vec3 |
| | 408 | stateset->addUniform(dv_i_Uniform); // vec3 could be float |
| | 409 | stateset->addUniform(dv_j_Uniform); // vec3 could be float |
| | 410 | stateset->addUniform(dv_k_Uniform); // vec3 |
| | 411 | stateset->addUniform(inversePeriodUniform); // float |
| | 412 | stateset->addUniform(startTime); // float |
| | 413 | |
| | 414 | |
| | 415 | // make it render after the normal transparent bin |
| | 416 | stateset->setRenderBinDetails(11,"DepthSortedBin"); |
| | 417 | |
| | 418 | #if 0 |
| 409 | | stateset->addUniform(position_Uniform); |
| 410 | | stateset->addUniform(dv_i_Uniform); |
| 411 | | stateset->addUniform(dv_j_Uniform); |
| 412 | | stateset->addUniform(dv_k_Uniform); |
| 413 | | stateset->addUniform(inversePeriodUniform); |
| 414 | | stateset->addUniform(startTime); |
| 415 | | stateset->addUniform(new osg::Uniform("particleColour", osg::Vec4(0.6,0.6,0.6,1.0))); |
| 416 | | |
| | 473 | |
| | 474 | #if 1 |
| | 475 | osgUtil::Optimizer::SpatializeGroupsVisitor sgv; |
| | 476 | group->accept(sgv); |
| | 477 | sgv.divide(); |
| | 478 | #endif |
| | 479 | |
| | 480 | #if 1 |
| | 481 | osg::StateSet* stateset = group->getOrCreateStateSet(); |
| | 482 | |
| | 483 | stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF); |
| | 484 | stateset->setMode(GL_BLEND, osg::StateAttribute::ON); |
| | 485 | |
| | 486 | osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0); |
| | 487 | stateset->addUniform(baseTextureSampler); |
| | 488 | |
| | 489 | osg::Texture2D* texture = new osg::Texture2D(createSpotLightImage(osg::Vec4(1.0f,1.0f,1.0f,1.0f),osg::Vec4(1.0f,1.0f,1.0f,0.0f),32,1.0)); |
| | 490 | stateset->setTextureAttribute(0, texture); |
| | 491 | |
| | 492 | stateset->addUniform(new osg::Uniform("particleColour", osg::Vec4(0.6,0.6,0.6,1.0))); |
| | 493 | stateset->addUniform(new osg::Uniform("particleSize", 0.01f)); |
| | 494 | |
| | 495 | osg::Uniform* previousModelViewUniform = new osg::Uniform("previousModelViewMatrix",osg::Matrix()); |
| | 496 | stateset->addUniform(previousModelViewUniform); |
| | 497 | |
| | 498 | group->setCullCallback(new CullCallback(previousModelViewUniform)); |
| | 499 | #endif |
| | 500 | |