void mapTimer(int tid){ int i; //man control controlTube(1,mousex,mousey); if (allTank[1].fireCD) allTank[1].fireCD--; watch("tank 1 CD ",allTank[1].fireCD); //autoRun();//DON'T TOUCH updateLaser(); //AI control for(i=2;i<=tankCount;i++) { if (allTank[i].fireCD) allTank[i].fireCD--; (*(allTank[i].ctrl))(i); } //view printMap(tid); }
void DSPNode::setIntensity (float newvalue) { currentSoundIntensity = newvalue; float r = currentSoundIntensity / 0.896909; if (r > 1.0) r=1.0; float g = (1.0 - currentSoundIntensity) / 0.103091; if (g > 1.0) g=1.0; currentSoundColor = osg::Vec3(r, g, 0.0); updateVUmeter(); updateLaser(); BROADCAST(this, "sf", "setIntensity", currentSoundIntensity); }
void DSPNode::drawLaser() { if (this->getAttachmentNode()->containsNode(laserGeode.get())) { this->getAttachmentNode()->removeChild(laserGeode.get()); laserGeode = NULL; } if (laserFlag > 0) { // create geode to hold lase: laserGeode = new osg::Geode(); laserGeode->setName(std::string(id->s_name) + ".laserGeode"); // draw laser as a cylinder: osg::Vec3 center; osg::Cylinder *laser; osg::Quat rot; center = osg::Vec3(0.0f,AS_DEBUG_SCALE*_length*.5,0.0f); laser = new osg::Cylinder(center, AS_LASER_RADIUS, AS_DEBUG_SCALE*_length); rot.makeRotate(osg::Vec3(0,0,1),center); laser->setRotation(rot); // make drawable and add to geode: osg::TessellationHints* hints = new osg::TessellationHints; hints->setDetailRatio(GENERIC_SHAPE_RESOLUTION); osg::ShapeDrawable* laserDrawable = new osg::ShapeDrawable(laser,hints); laserGeode->addDrawable(laserDrawable); // turn off lighting effects: osg::StateSet *laserStateSet = new osg::StateSet; laserStateSet->setMode( GL_LIGHTING, osg::StateAttribute::OFF); laserGeode->setStateSet ( laserStateSet ); // update the color based on the current sound intensity: updateLaser(); // add it to the node: this->getAttachmentNode()->addChild( laserGeode.get() ); } }