Esempio n. 1
0
void PyramidParamDlgProc::Update()
{
    if (mpPyramidObj == NULL) return;
    BOOL usePhysUVs = mpPyramidObj->GetUsePhysicalScaleUVs();
    CheckDlgButton(mhWnd, IDC_REAL_WORLD_MAP_SIZE, usePhysUVs);
    EnableWindow(GetDlgItem(mhWnd, IDC_REAL_WORLD_MAP_SIZE), mpPyramidObj->HasUVW());
}
Esempio n. 2
0
RefTargetHandle PyramidObject::Clone(RemapDir& remap) 
	{
	PyramidObject* newob = new PyramidObject(FALSE);	
	newob->ReplaceReference(0,remap.CloneRef(pblock));	
	newob->ivalid.SetEmpty();	
	BaseClone(this, newob, remap);
    newob->SetUsePhysicalScaleUVs(GetUsePhysicalScaleUVs());
	return(newob);
	}
void AnimController::priv_walk_anim_node( PyramidObject *node )
{
	setBonePose( node );

	PyramidObject *child = 0;

	if (node->getChild() != 0)	{
		child = (PyramidObject *)node->getChild();
		while (child != 0)	{
			priv_walk_anim_node( child );
			child = (PyramidObject *)child->getSibling();
		}
	}
}
Esempio n. 4
0
INT_PTR PyramidParamDlgProc::DlgProc(
		TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch (msg) {
    case WM_INITDIALOG: {
        mhWnd = hWnd;
        Update();
        break;
    }
    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDC_GENTEXTURE:
            Update();
            break;

        case IDC_REAL_WORLD_MAP_SIZE: {
            BOOL check = IsDlgButtonChecked(hWnd, IDC_REAL_WORLD_MAP_SIZE);
            theHold.Begin();
            mpPyramidObj->SetUsePhysicalScaleUVs(check);
            theHold.Accept(GetString(IDS_DS_PARAMCHG));
            mpPyramidObj->ip->RedrawViews(mpPyramidObj->ip->GetTime());
            break;
        }
            
        }
        break;
        
    }
	return FALSE;
}
Esempio n. 5
0
INT_PTR PyramidTypeInDlgProc::DlgProc(
		TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
	{
	switch (msg) {
		case WM_COMMAND:
			switch (LOWORD(wParam)) {
				case IDC_PR_CREATE: {
					if (ob->crtHeight==0.0f) return TRUE;
					
					// We only want to set the value if the object is 
					// not in the scene.
					if (ob->TestAFlag(A_OBJ_CREATING)) {
						ob->pblock->SetValue(PB_HEIGHT,0,ob->crtHeight);
						ob->pblock->SetValue(PB_WIDTH,0,ob->crtWidth);
						ob->pblock->SetValue(PB_DEPTH,0,ob->crtDepth);
						}

					Matrix3 tm(1);
					tm.SetTrans(ob->crtPos);
					ob->suspendSnap = FALSE;
					ob->ip->NonMouseCreate(tm);					
					// NOTE that calling NonMouseCreate will cause this
					// object to be deleted. DO NOT DO ANYTHING BUT RETURN.
					return TRUE;	
					}
				}
			break;	
		}
	return FALSE;
	}
void AnimController::setBonePose( PyramidObject *node )
{
	PyramidObject *childNode = (PyramidObject *)node;
	PyramidObject *parentNode = (PyramidObject *)node->getParent();

	if( parentNode == GraphicsObjMan::getMainTree()->getRoot() )
		return;

	if (parentNode != 0 && childNode != 0)	{
		// Now get the world matrices
		Vect start(0.0f,0.0f,0.0f);

		parentNode->transform();
		Vect ptA = start * parentNode->getWorld();

		childNode->transform();
		Vect ptB = start * childNode->getWorld();

		// direction between the anchor points of the respective bones
		Vect dir = -(ptB - ptA);

		// length of the bone 0
		float mag = dir.mag();

		// Set the orientation and length for bone 0
		Matrix S( SCALE, BONE_WIDTH, BONE_WIDTH, mag);
		Quat Q( ROT_ORIENT, dir.getNorm(), Vect( 0.0f, 1.0f, 0.0f) );
		Matrix T( TRANS, ptB );

		Matrix BoneOrient = S * Q * T;

		childNode->setBoneOrientation( BoneOrient );
	}
}
void SetHumanoidHierarchy()
{
	// ____________________ ANIMATION TESTING _______________________
	myPyramid = new PyramidModel();
	myPyramid->createVAO();

	// __________________________HUMANOID TEST__________________
	PCSTree *tree = GraphicsObjMan::getMainTree();
	pRootNode = tree->getRoot();

	PyramidObject *pHips = new PyramidObject;
	pHips->setIndex(0);
//	pHips->setScale(0.1f);
	pHips->setName("Hips");
	tree->insert( pHips, pRootNode );

	PyramidObject *pSpine_Dummy = new PyramidObject;
	pSpine_Dummy->setIndex(1);
	pSpine_Dummy->setName("Spine_Dummy");
	tree->insert( pSpine_Dummy, pHips );

	PyramidObject *pSpine = new PyramidObject;
	pSpine->setIndex(2);
	pSpine->setName("Spine");
	tree->insert( pSpine, pSpine_Dummy );

	PyramidObject *pSpine1 = new PyramidObject;
	pSpine1->setIndex(3);
	pSpine1->setName("Spine1");
	tree->insert( pSpine1, pSpine );

	PyramidObject *pSpine2 = new PyramidObject;
	pSpine2->setIndex(4);
	pSpine2->setName("Spine2");
	tree->insert( pSpine2, pSpine1 );

	PyramidObject *pNeck = new PyramidObject;
	pNeck->setIndex(5);
	pNeck->setName("Neck");
	tree->insert( pNeck, pSpine2 );

	PyramidObject *pHead = new PyramidObject;
	pHead->setIndex(6);
	pHead->setName("Head");
	tree->insert( pHead, pNeck );

	PyramidObject *pHead_End = new PyramidObject;
	pHead_End->setIndex(7);
	pHead_End->setName("Head_End");
	tree->insert( pHead_End, pHead );

	PyramidObject *pLeftShoulder_Dummy = new PyramidObject;
	pLeftShoulder_Dummy->setIndex(8);
	pLeftShoulder_Dummy->setName("LeftShoulder_Dummy");
	tree->insert( pLeftShoulder_Dummy, pSpine2 );

	PyramidObject *pLeftShoulder = new PyramidObject;
	pLeftShoulder->setIndex(9);
	pLeftShoulder->setName("LeftShoulder");
	tree->insert( pLeftShoulder, pLeftShoulder_Dummy );

	PyramidObject *pLeftArm_Dummy = new PyramidObject;
	pLeftArm_Dummy->setIndex(10);
	pLeftArm_Dummy->setName("LeftArm_Dummy");
	tree->insert( pLeftArm_Dummy, pLeftShoulder );

	PyramidObject *pLeftArm = new PyramidObject;
	pLeftArm->setIndex(11);
	pLeftArm->setName("LeftArm");
	tree->insert( pLeftArm, pLeftArm_Dummy );

	PyramidObject *pLeftArmRoll = new PyramidObject;
	pLeftArmRoll->setIndex(12);
	pLeftArmRoll->setName("LeftArmRoll");
	tree->insert( pLeftArmRoll, pLeftArm );

	PyramidObject *pLeftForeArm = new PyramidObject;
	pLeftForeArm->setIndex(13);
	pLeftForeArm->setName("LeftForeArm");
	tree->insert( pLeftForeArm, pLeftArmRoll );

	PyramidObject *pLeftForeArmRoll = new PyramidObject;
	pLeftForeArmRoll->setIndex(14);
	pLeftForeArmRoll->setName("LeftForeArmRoll");
	tree->insert( pLeftForeArmRoll, pLeftForeArm );

	PyramidObject *pLeftHand = new PyramidObject;
	pLeftHand->setIndex(15);
	pLeftHand->setName("LeftHand");
	tree->insert( pLeftHand, pLeftForeArmRoll );

	PyramidObject *pLeftThumb1 = new PyramidObject;
	pLeftThumb1->setIndex(16);
	pLeftThumb1->setName("LeftThumb1");
	tree->insert( pLeftThumb1, pLeftHand );

	PyramidObject *pLeftThumb2 = new PyramidObject;
	pLeftThumb2->setIndex(17);
	pLeftThumb2->setName("LeftThumb2");
	tree->insert( pLeftThumb2, pLeftThumb1 );

	PyramidObject *pLeftThumb3 = new PyramidObject;
	pLeftThumb3->setIndex(18);
	pLeftThumb3->setName("LeftThumb3");
	tree->insert( pLeftThumb3, pLeftThumb2 );

	PyramidObject *pLeftThumb_End = new PyramidObject;
	pLeftThumb_End->setIndex(19);
	pLeftThumb_End->setName("LeftThumb_End");
	tree->insert( pLeftThumb_End, pLeftThumb3 );

	PyramidObject *pLeftIndex1 = new PyramidObject;
	pLeftIndex1->setIndex(20);
	pLeftIndex1->setName("LeftIndex1");
	tree->insert( pLeftIndex1, pLeftHand );

	PyramidObject *pLeftIndex2 = new PyramidObject;
	pLeftIndex2->setIndex(21);
	pLeftIndex2->setName("LeftIndex2");
	tree->insert( pLeftIndex2, pLeftIndex1 );

	PyramidObject *pLeftIndex3 = new PyramidObject;
	pLeftIndex3->setIndex(22);
	pLeftIndex3->setName("LeftIndex3");
	tree->insert( pLeftIndex3, pLeftIndex2 );

	PyramidObject *pLeftIndex_End = new PyramidObject;
	pLeftIndex_End->setIndex(23);
	pLeftIndex_End->setName("LeftIndex_End");
	tree->insert( pLeftIndex_End, pLeftIndex3 );

	PyramidObject *pLeftMiddle1 = new PyramidObject;
	pLeftMiddle1->setIndex(24);
	pLeftMiddle1->setName("LeftMiddle1");
	tree->insert( pLeftMiddle1, pLeftHand );

	PyramidObject *pLeftMiddle2 = new PyramidObject;
	pLeftMiddle2->setIndex(25);
	pLeftMiddle2->setName("LeftMiddle2");
	tree->insert( pLeftMiddle2, pLeftMiddle1 );

	PyramidObject *pLeftMiddle3 = new PyramidObject;
	pLeftMiddle3->setIndex(26);
	pLeftMiddle3->setName("LeftMiddle3");
	tree->insert( pLeftMiddle3, pLeftMiddle2 );

	PyramidObject *pLeftMiddle_End = new PyramidObject;
	pLeftMiddle_End->setIndex(27);
	pLeftMiddle_End->setName("LeftMiddle_End");
	tree->insert( pLeftMiddle_End, pLeftMiddle3 );

	PyramidObject *pLeftRing1 = new PyramidObject;
	pLeftRing1->setIndex(28);
	pLeftRing1->setName("LeftRing1");
	tree->insert( pLeftRing1, pLeftHand );

	PyramidObject *pLeftRing2 = new PyramidObject;
	pLeftRing2->setIndex(29);
	pLeftRing2->setName("LeftRing2");
	tree->insert( pLeftRing2, pLeftRing1 );

	PyramidObject *pLeftRing3 = new PyramidObject;
	pLeftRing3->setIndex(30);
	pLeftRing3->setName("LeftRing3");
	tree->insert( pLeftRing3, pLeftRing2 );

	PyramidObject *pLeftRing_End = new PyramidObject;
	pLeftRing_End->setIndex(31);
	pLeftRing_End->setName("LeftRing_End");
	tree->insert( pLeftRing_End, pLeftRing3 );

	PyramidObject *pLeftPinky1 = new PyramidObject;
	pLeftPinky1->setIndex(32);
	pLeftPinky1->setName("LeftPinky1");
	tree->insert( pLeftPinky1, pLeftHand );

	PyramidObject *pLeftPinky2 = new PyramidObject;
	pLeftPinky2->setIndex(33);
	pLeftPinky2->setName("LeftPinky2");
	tree->insert( pLeftPinky2, pLeftPinky1 );

	PyramidObject *pLeftPinky3 = new PyramidObject;
	pLeftPinky3->setIndex(34);
	pLeftPinky3->setName("LeftPinky3");
	tree->insert( pLeftPinky3, pLeftPinky2 );

	PyramidObject *pLeftPinky_End = new PyramidObject;
	pLeftPinky_End->setIndex(35);
	pLeftPinky_End->setName("LeftPinky_End");
	tree->insert( pLeftPinky_End, pLeftPinky3 );

	PyramidObject *pRightShoulder_Dummy = new PyramidObject;
	pRightShoulder_Dummy->setIndex(36);
	pRightShoulder_Dummy->setName("RightShoulder_Dummy");
	tree->insert( pRightShoulder_Dummy, pSpine2 );

	PyramidObject *pRightShoulder = new PyramidObject;
	pRightShoulder->setIndex(37);
	pRightShoulder->setName("RightShoulder");
	tree->insert( pRightShoulder, pRightShoulder_Dummy );

	PyramidObject *pRightArm_Dummy = new PyramidObject;
	pRightArm_Dummy->setIndex(38);
	pRightArm_Dummy->setName("RightArm_Dummy");
	tree->insert( pRightArm_Dummy, pRightShoulder );

	PyramidObject *pRightArm = new PyramidObject;
	pRightArm->setIndex(39);
	pRightArm->setName("RightArm");
	tree->insert( pRightArm, pRightArm_Dummy );

	PyramidObject *pRightArmRoll = new PyramidObject;
	pRightArmRoll->setIndex(40);
	pRightArmRoll->setName("RightArmRoll");
	tree->insert( pRightArmRoll, pRightArm );

	PyramidObject *pRightForeArm = new PyramidObject;
	pRightForeArm->setIndex(41);
	pRightForeArm->setName("RightForeArm");
	tree->insert( pRightForeArm, pRightArmRoll );

	PyramidObject *pRightForeArmRoll = new PyramidObject;
	pRightForeArmRoll->setIndex(42);
	pRightForeArmRoll->setName("RightForeArmRoll");
	tree->insert( pRightForeArmRoll, pRightForeArm );

	PyramidObject *pRightHand = new PyramidObject;
	pRightHand->setIndex(43);
	pRightHand->setName("RightHand");
	tree->insert( pRightHand, pRightForeArmRoll );

	PyramidObject *pRightThumb1 = new PyramidObject;
	pRightThumb1->setIndex(44);
	pRightThumb1->setName("RightThumb1");
	tree->insert( pRightThumb1, pRightHand );

	PyramidObject *pRightThumb2 = new PyramidObject;
	pRightThumb2->setIndex(45);
	pRightThumb2->setName("RightThumb2");
	tree->insert( pRightThumb2, pRightThumb1 );

	PyramidObject *pRightThumb3 = new PyramidObject;
	pRightThumb3->setIndex(46);
	pRightThumb3->setName("RightThumb3");
	tree->insert( pRightThumb3, pRightThumb2 );

	PyramidObject *pRightThumb_End = new PyramidObject;
	pRightThumb_End->setIndex(47);
	pRightThumb_End->setName("RightThumb_End");
	tree->insert( pRightThumb_End, pRightThumb3 );

	PyramidObject *pRightIndex1 = new PyramidObject;
	pRightIndex1->setIndex(48);
	pRightIndex1->setName("RightIndex1");
	tree->insert( pRightIndex1, pRightHand );

	PyramidObject *pRightIndex2 = new PyramidObject;
	pRightIndex2->setIndex(49);
	pRightIndex2->setName("RightIndex2");
	tree->insert( pRightIndex2, pRightIndex1 );

	PyramidObject *pRightIndex3 = new PyramidObject;
	pRightIndex3->setIndex(50);
	pRightIndex3->setName("RightIndex3");
	tree->insert( pRightIndex3, pRightIndex2 );

	PyramidObject *pRightIndex_End = new PyramidObject;
	pRightIndex_End->setIndex(51);
	pRightIndex_End->setName("RightIndex_End");
	tree->insert( pRightIndex_End, pRightIndex3 );

	PyramidObject *pRightMiddle1 = new PyramidObject;
	pRightMiddle1->setIndex(52);
	pRightMiddle1->setName("RightMiddle1");
	tree->insert( pRightMiddle1, pRightHand );

	PyramidObject *pRightMiddle2 = new PyramidObject;
	pRightMiddle2->setIndex(53);
	pRightMiddle2->setName("RightMiddle2");
	tree->insert( pRightMiddle2, pRightMiddle1 );

	PyramidObject *pRightMiddle3 = new PyramidObject;
	pRightMiddle3->setIndex(54);
	pRightMiddle3->setName("RightMiddle3");
	tree->insert( pRightMiddle3, pRightMiddle2 );

	PyramidObject *pRightMiddle_End = new PyramidObject;
	pRightMiddle_End->setIndex(55);
	pRightMiddle_End->setName("RightMiddle_End");
	tree->insert( pRightMiddle_End, pRightMiddle3 );

	PyramidObject *pRightRing1 = new PyramidObject;
	pRightRing1->setIndex(56);
	pRightRing1->setName("RightRing1");
	tree->insert( pRightRing1, pRightHand );

	PyramidObject *pRightRing2 = new PyramidObject;
	pRightRing2->setIndex(57);
	pRightRing2->setName("RightRing2");
	tree->insert( pRightRing2, pRightRing1 );

	PyramidObject *pRightRing3 = new PyramidObject;
	pRightRing3->setIndex(58);
	pRightRing3->setName("RightRing3");
	tree->insert( pRightRing3, pRightRing2 );

	PyramidObject *pRightRing_End = new PyramidObject;
	pRightRing_End->setIndex(59);
	pRightRing_End->setName("RightRing_End");
	tree->insert( pRightRing_End, pRightRing3 );

	PyramidObject *pRightPinky1 = new PyramidObject;
	pRightPinky1->setIndex(60);
	pRightPinky1->setName("RightPinky1");
	tree->insert( pRightPinky1, pRightHand );

	PyramidObject *pRightPinky2 = new PyramidObject;
	pRightPinky2->setIndex(61);
	pRightPinky2->setName("RightPinky2");
	tree->insert( pRightPinky2, pRightPinky1 );

	PyramidObject *pRightPinky3 = new PyramidObject;
	pRightPinky3->setIndex(62);
	pRightPinky3->setName("RightPinky3");
	tree->insert( pRightPinky3, pRightPinky2 );

	PyramidObject *pRightPinky_End = new PyramidObject;
	pRightPinky_End->setIndex(63);
	pRightPinky_End->setName("RightPinky_End");
	tree->insert( pRightPinky_End, pRightPinky3 );

	PyramidObject *pLeftHips_Dummy = new PyramidObject;
	pLeftHips_Dummy->setIndex(64);
	pLeftHips_Dummy->setName("LeftHips_Dummy");
	tree->insert( pLeftHips_Dummy, pHips );

	PyramidObject *pLeftUpLeg = new PyramidObject;
	pLeftUpLeg->setIndex(65);
	pLeftUpLeg->setName("LeftUpLeg");
	tree->insert( pLeftUpLeg, pLeftHips_Dummy );

	PyramidObject *pLeftUpLegRoll = new PyramidObject;
	pLeftUpLegRoll->setIndex(66);
	pLeftUpLegRoll->setName("LeftUpLegRoll");
	tree->insert( pLeftUpLegRoll, pLeftUpLeg );

	PyramidObject *pLeftLeg = new PyramidObject;
	pLeftLeg->setIndex(67);
	pLeftLeg->setName("LeftLeg");
	tree->insert( pLeftLeg, pLeftUpLegRoll );

	PyramidObject *pLeftLegRoll = new PyramidObject;
	pLeftLegRoll->setIndex(68);
	pLeftLegRoll->setName("LeftLegRoll");
	tree->insert( pLeftLegRoll, pLeftLeg );

	PyramidObject *pLeftFoot = new PyramidObject;
	pLeftFoot->setIndex(69);
	pLeftFoot->setName("LeftFoot");
	tree->insert( pLeftFoot, pLeftLegRoll );

	PyramidObject *pLeftToes = new PyramidObject;
	pLeftToes->setIndex(70);
	pLeftToes->setName("LeftToes");
	tree->insert( pLeftToes, pLeftFoot );

	PyramidObject *pLeftToes_End = new PyramidObject;
	pLeftToes_End->setIndex(71);
	pLeftToes_End->setName("LeftToes_End");
	tree->insert( pLeftToes_End, pLeftToes );

	PyramidObject *pRightHips_Dummy = new PyramidObject;
	pRightHips_Dummy->setIndex(72);
	pRightHips_Dummy->setName("RightHips_Dummy");
	tree->insert( pRightHips_Dummy, pHips );

	PyramidObject *pRightUpLeg = new PyramidObject;
	pRightUpLeg->setIndex(73);
	pRightUpLeg->setName("RightUpLeg");
	tree->insert( pRightUpLeg, pRightHips_Dummy );

	PyramidObject *pRightUpLegRoll = new PyramidObject;
	pRightUpLegRoll->setIndex(74);
	pRightUpLegRoll->setName("RightUpLegRoll");
	tree->insert( pRightUpLegRoll, pRightUpLeg );

	PyramidObject *pRightLeg = new PyramidObject;
	pRightLeg->setIndex(75);
	pRightLeg->setName("RightLeg");
	tree->insert( pRightLeg, pRightUpLegRoll );

	PyramidObject *pRightLegRoll = new PyramidObject;
	pRightLegRoll->setIndex(76);
	pRightLegRoll->setName("RightLegRoll");
	tree->insert( pRightLegRoll, pRightLeg );

	PyramidObject *pRightFoot = new PyramidObject;
	pRightFoot->setIndex(77);
	pRightFoot->setName("RightFoot");
	tree->insert( pRightFoot, pRightLegRoll );

	PyramidObject *pRightToes = new PyramidObject;
	pRightToes->setIndex(78);
	pRightToes->setName("RightToes");
	tree->insert( pRightToes, pRightFoot );

	PyramidObject *pRightToes_End = new PyramidObject;
	pRightToes_End->setIndex(79);
	pRightToes_End->setName("RightToes_End");
	tree->insert( pRightToes_End, pRightToes );
}
Esempio n. 8
0
void createPyramidObjects(Pyramid* const pPyramid, GraphicsObjectManager* const goMgr)
{
    PyramidObject *p = new PyramidObject("Pyramid A", pPyramid);
    p->setPos( Vect(0.0f, 0.0f, -20.0f) );
    p->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p->setLightColor( Vect(0.0f, 1.0f, 0.0f, 1.0f) );
    p->setTexture(TEX1);
    goMgr->addObject(p);


    PyramidObject	*p1 = new PyramidObject("Pyramid B", pPyramid);
    p1->setPos( Vect(-2.0f, 0.0f, -20.0f) );
    p1->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p1->setLightColor( Vect(1.0f, 0.0f, 0.0f, 1.0f) );
    p1->setTexture(TEX2);
    goMgr->addObject(p1);


    PyramidObject *p2 = new PyramidObject("Pyramid C", pPyramid);
    p2->setPos( Vect(2.0f, 0.0f, -20.0f) );
    p2->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p2->setLightColor( Vect(0.30f, 0.30f, 1.2f, 1.0f) );
    p2->setTexture(TEX1);
    goMgr->addObject(p2);

    PyramidObject *p3 = new PyramidObject("Pyramid D", pPyramid);
    p3->setPos( Vect(0.0f, 1.5f, -20.0f) );
    p3->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p3->setLightColor( Vect(1.0f, 1.0f, 0.0f, 1.0f) );
    p3->setTexture(TEX2);
    goMgr->addObject(p3);


    PyramidObject	*p4 = new PyramidObject("Pyramid E", pPyramid);
    p4->setPos( Vect(-2.0f, 1.5f, -20.0f) );
    p4->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p4->setLightColor( Vect(1.0f, 0.0f, 1.0f, 1.0f) );
    p4->setTexture(TEX1);
    goMgr->addObject(p4);


    PyramidObject *p5 = new PyramidObject("Pyramid F", pPyramid);
    p5->setPos( Vect(2.0f, 1.5f, -20.0f) );
    p5->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p5->setLightColor( Vect(0.0f, 1.00f, 1.0f, 1.0f) );
    p5->setTexture(TEX2);
    goMgr->addObject(p5);


    PyramidObject *p6 = new PyramidObject("Pyramid G", pPyramid);
    p6->setPos( Vect(0.0f, -1.5f, -20.0f) );
    p6->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p6->setLightColor( Vect(1.0f, 1.0f, 0.0f, 1.0f) );
    p6->setTexture(TEX1);
    goMgr->addObject(p6);


    PyramidObject	*p7 = new PyramidObject("Pyramid H", pPyramid);
    p7->setPos( Vect(-2.0f, -1.5f, -20.0f) );
    p7->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p7->setLightColor( Vect(1.0f, 0.0f, 1.0f, 1.0f) );
    p7->setTexture(TEX2);
    goMgr->addObject(p7);


    PyramidObject *p8 = new PyramidObject("Pyramid I", pPyramid);
    p8->setPos( Vect(2.0f, -1.5f, -20.0f) );
    p8->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    p8->setLightColor( Vect(0.0f, 1.0f, 1.0f, 1.0f) );
    p8->setTexture(TEX1);
    goMgr->addObject(p8);
}
Esempio n. 9
0
void Skeleton::setBonePose(GraphicsObject * node, FrameBucket* pResult)
{
    // need this value for Scale Vector - would it change in derived classes?
    const float BONE_WIDTH = 2.0f;
	// Now get the world matrices - we know nodes are PyramidObjects for Skeleton
    // this casting may not be needed if we create a new AnimationObject to pass in instead of GraphicsObject
    PyramidObject *childNode = (PyramidObject *)node;
    PyramidObject *parentNode = (PyramidObject *)node->getParent();

    // Get the manager
    GraphicsObjectManager *goMgr = GraphicsObjectManager::getInstance();
    PCSTree* tree = goMgr->getTree();
	PCSNode* root = tree->getRoot();

    // for bone Bip01 - it is the anchor point, no need to set its pose when its parent is dummy root node
    if(parentNode == root)
        return;

	if( parentNode != 0 && childNode != 0 )
	{
        // starting point
	    Vect start(0.0f,0.0f,0.0f);

        // calling transform first to evaluate an up-to-date world, then get starting point in World coords
        // ***ORDER*** do this for parent first, then child - in transform, p1 will get parent's world matrix
        parentNode->transform(pResult);
	    Vect ptA = start * parentNode->getWorld();

        childNode->transform(pResult);
	    Vect ptB = start * childNode->getWorld();

        // At this point, we have the two bones initial positions in world space
        // Now get the direction between two anchor points of respective bones, and direction
		Vect dir = -(ptB- ptA);
		float mag = dir.mag();

        // used to flip pyramids to point outward
        Matrix T_flip(TRANS, 0.0f, 0.0f, 1.0f);
		// rotates it to Z axis
		Matrix R_flip( ROT_X, 180.0f * MATH_PI_180);

        Matrix S( SCALE, BONE_WIDTH, BONE_WIDTH, mag);
		Quat Q( ROT_ORIENT, dir.getNorm(), Vect( 0.0f, 1.0f, 0.0f) );
        Matrix T(TRANS, ptB);

        
        Matrix BoneOrient = S * Q * T;
        // Matrix BoneOrient = R_flip * T_flip * S * Q * T ;
        // Matrix BoneOrient = S * Q ;
        // Matrix BoneOrient = S;

        childNode->setBoneOrientation(BoneOrient);
    }

    /* deal with last node, when there isn't a terminal node - does this help in any way? 
    // copy orientation matrix from grandparent to set Parent's orientation 
	if( parentNode != 0 && childNode == 0 )
    {
		// get the parent's parent  -> grandParent
		GraphicsObject *grandParentNode = (GraphicsObject *)parentNode->getParent();
		Matrix BoneOrient = grandParentNode->getBoneOrientation();

		parentNode->setBoneOrientation( BoneOrient );
        // should be childNode now???
	} */
}
void AnimController::setSkeletonController( )
{
	PyramidObject *walker = this->skeletonRoot;
	walker->setControllerDepthFirst( this );
}