Ejemplo n.º 1
0
// Rotary - we do this "pre-draw" of all of our possible selections, that will 
// eliminate the "flicker" on the first selection of the item, because we will have
// already drawn the item one time before (here). 
void Rotary::draw()
{
   if (preDrawSelectList) {
      int start = 1;
      Basic::Pair* p = findByIndex(start);
      while (p != 0) {
         BasicGL::Graphic* g = dynamic_cast<BasicGL::Graphic*>(p->object());
         if (g != 0) g->draw();
         p = findByIndex(++start);
      }
      preDrawSelectList = false;
   }

   BaseClass::draw();
}
Ejemplo n.º 2
0
//------------------------------------------------------------------------------
// getRCS() -- Get the RCS
//------------------------------------------------------------------------------
LCreal SigSwitch::getRCS(const Emission* const em)
{
   LCreal rcs = 0.0;

   // Find our ownship player ...
   const Player* ownship = static_cast<const Player*>(findContainerByType(typeid(Player)));
   if (ownship != 0) {

      // get our ownship's camouflage type
      unsigned int camouflage = ownship->getCamouflageType();
      camouflage++; // our components are one based

      // find a RfSignature with this index
      Basic::Pair* pair = findByIndex(camouflage);
      if (pair != 0) {
         RfSignature* sig = dynamic_cast<RfSignature*>( pair->object() );
         if (sig != 0) {

            // OK -- we've found the correct RfSignature subcomponent
            // now let it do all of the work
            rcs = sig->getRCS(em);

         }
      }

   }

   return rcs;
}
Ejemplo n.º 3
0
bool Component::select(const Number* const num)
{
    bool ok {true};
    selected = nullptr;
    setSelectionName(nullptr);
    if (num != nullptr) {
        setSelectionName(num);
        Pair* p = findByIndex(num->getInt());
        if (p != nullptr) {
           selected = static_cast<Component*>(p->object());
        }
        else {
           std::cerr << "Component::select: index out of range; num = " << num->getInt() << std::endl;
           ok = false;
        }
    }
    return ok;
}
Ejemplo n.º 4
0
bool Component::select(const Number* const num)
{
    bool ok = true;
    selected = 0;
    setSelectionName(0);
    if (num != 0) {
        setSelectionName(num);
        Pair* p = findByIndex(num->getInt());
        if (p != 0) {
           selected = (Component*) p->object();
        }
        else {
           std::cerr << "Component::select: index out of range; num = " << num->getInt() << std::endl;
           ok = false; 
        }
    }
    return ok;
}
Ejemplo n.º 5
0
void Teddy::SetAnimationHierarchy()
{

	// Load the model 
		PyramidModel *pPyramidModel = new PyramidModel( "pyramidModel.azul" );pPyramidModel;

	// Create/Load Shader 
		ShaderObject *pShaderObject_textureLight = new ShaderObject( ShaderName::TEXTURE_POINT_LIGHT, "texturePointLightDiff");
	
	// Setup renderer
		Render_TextureLight *pRender_TextureLight    = new Render_TextureLight( pShaderObject_textureLight );pRender_TextureLight;


	// GraphicsObject for a specific instance
		GraphicsObject_TextureLight *pGraphics_TextureLight;pGraphics_TextureLight;

	// Create GameObject
	Vect color;
	Vect pos(1,1,1);

	PCSTree *pTree = GameObjectMan::GetPCSTree();
	root = pTree->getRoot();

	GameObjectRigid *pGameRigid = new GameObjectRigid( 0 );
	GameObjectMan::Add(  pGameRigid, GameObjectMan::GetRoot() );
	pGameRigid->setName("Rigid");
	pGameRigid->scale = Vect(0.60f,0.60f,0.60f);
	pGameRigid->pos = Vect(50,-30,0);
	

	//// TEDDY BEAR
	color.set(1.00f, 1.0f, 50.00f, 1.0f);
	
	
	
	std::vector<MyGameObjectAnim*> goList;
	for (unsigned int i = 0; i < listHirerachy.size(); i++)
	{
			//initial
			pGraphics_TextureLight = new GraphicsObject_TextureLight( pPyramidModel, pRender_TextureLight, TextureName::DUCKWEED, color, pos);
			MyGameObjectAnim *pBone = new MyGameObjectAnim( pGraphics_TextureLight );
			pBone->setIndex(listHirerachy[i].index);
			pBone->setName(listHirerachy[i].Name);
			goList.push_back(pBone);

			pBone->tedy = this;
			if(listHirerachy[i].index==0)
			{
				pFirstBone= pBone;
			}

	}
	for (unsigned int j = 0; j < listHirerachy.size(); j++)
	{
			
			//craete hierachy
			if( j == 0)
			{
				MyGameObjectAnim* temp = goList[0];
				GameObjectMan::Add( temp, pGameRigid );
				//GameObjectMan::Add( temp,GameObjectMan::GetRoot());
			}
			else
			{	
				MyGameObjectAnim* temp = goList[j];
				MyGameObjectAnim* tempParent = findByIndex(goList,listHirerachy[j].ParentIndex);
				GameObjectMan::Add( temp, tempParent );
			}
	}
	pTree->printTree();
}