CIwFBBox Physics::GetBBoxFromRigidBody( const btRigidBody* b ) { CIwFBBox bbox; btVector3 vecMaxEdge, vecMinEdge; b->getAabb( vecMinEdge, vecMaxEdge ); bbox.minV = CIwFVec3( vecMinEdge.getX(), vecMinEdge.getY(), vecMinEdge.getZ() ); bbox.maxV = CIwFVec3( vecMaxEdge.getX(), vecMaxEdge.getY(), vecMaxEdge.getZ() ); return bbox; }
void setupPlayer() { Player *player = getGameState()->getPlayer(); if (!player->isReady()) { return; } // Set viewing position with the Y axis as upright. viewMatrix.SetIdentity(); viewMatrix.LookAt(CIwFVec3(0,-11,0), CIwFVec3(0,0,100), CIwFVec3(0,-1,0)); // Rotate according to compass heading viewMatrix.PostRotateY(rad(player->getHeading())); IwGxSetViewMatrix(&viewMatrix); }
void MyWorld::SpawnCustomer() { if ( iActiveCustomers >= Actors.size()) return; Actor* customer = Actors[iActiveCustomers++]; if ( customer->m_Type == Actor::EActorType_MyActor) { ((MyActor*)customer)->v3TargetPosition = CIwFVec3(0.f, 0.f, -90.f); customer->setPosition(0.f, 0.f, 90.f); customer->setVisible(true); } else { SpawnCustomer(); } }
CIwFMat Physics::GetMatrixFromRigidBody( const btRigidBody* b ) { CIwFMat modelMatrix; btMatrix3x3 mRot; btTransform btTrans = b->getWorldTransform(); btVector3 pos = btTrans.getOrigin(); mRot = btTrans.getBasis(); modelMatrix.SetIdentity(); for( int i = 0, j = 0; i < 3; ++i, j = 0 ) { modelMatrix.m[i][j] = ( mRot.getRow( i ).x() ); modelMatrix.m[i][++j] = ( mRot.getRow( i ).y() ); modelMatrix.m[i][++j] = ( mRot.getRow( i ).z() ); } modelMatrix.SetTrans( CIwFVec3( pos[0], pos[1], pos[2] ) ); return modelMatrix; }
void GhostCollision::RenderEctoplasmaBar(float ectoPercent, double ghostRotation) { CIwFMat ectoMatrix = CIwFMat(); ectoMatrix.CopyRot(*modelMatrix); ectoMatrix.CopyTrans(*modelMatrix); ectoMatrix.PostRotateY(PI-ghostRotation); IwGxSetModelMatrix(&ectoMatrix); IwGxSetScreenSpaceSlot(1); if (ghostW < 0 || ghostX < 0 || ghostY < 0) ResolveLocation(); const int16 w = 180; const int16 border_x1 = ghostX+ghostW/2 - (float)w*ectobarScale; const int16 border_x2 = ghostX+ghostW/2 + (float)w*ectobarScale; const float border_y1 = ghostY+0x20; const float border_y2 = ghostY+0x20 + (float)0x10*ectobarScale; const int16 z = 0x6; { CIwMaterial* pMat = IW_GX_ALLOC_MATERIAL(); pMat->SetModulateMode(CIwMaterial::MODULATE_RGB); pMat->SetAlphaMode(CIwMaterial::ALPHA_BLEND); pMat->SetTexture(borderTexture); int16 x1 = border_x1, x2 = border_x2; float y1 = border_y1, y2 = border_y2; border_Verts[0] = CIwFVec3(x1, y2, -z); border_Verts[1] = CIwFVec3(x2, y2, -z); border_Verts[2] = CIwFVec3(x2, y1, -z); border_Verts[3] = CIwFVec3(x1, y1, -z); border_Verts[4] = CIwFVec3(x1, y2, z); border_Verts[5] = CIwFVec3(x2, y2, z); border_Verts[6] = CIwFVec3(x2, y1, z); border_Verts[7] = CIwFVec3(x1, y1, z); IwGxSetMaterial(pMat); IwGxSetVertStream(border_Verts, 8); //IwGxSetColStream(s_Cols, 8); IwGxSetUVStream(s_UVs); IwGxDrawPrims(IW_GX_QUAD_STRIP, s_QuadStrip, 4); } float start_y1 = border_y1 + fabs((float)(border_y2 - border_y1)*0.200); float start_y2 = start_y1 + fabs((float)(border_y2 - border_y1)*0.720); float startWhScale = (float)((double)startTexture->GetWidth() / startTexture->GetHeight()); int16 startW = (start_y2 - start_y1) * startWhScale; int16 start_x1 = border_x1 + abs((float)(border_x2 - border_x1)*0.0097); int16 start_x2 = start_x1 + startW; { CIwMaterial* pMat = IW_GX_ALLOC_MATERIAL(); pMat->SetModulateMode(CIwMaterial::MODULATE_RGB); pMat->SetAlphaMode(CIwMaterial::ALPHA_BLEND); pMat->SetTexture(startTexture); int16 x1 = start_x1, x2 = start_x2; float y1 = start_y1, y2 = start_y2; start_Verts[0] = CIwFVec3(x1, y2, -z); start_Verts[1] = CIwFVec3(x2, y2, -z); start_Verts[2] = CIwFVec3(x2, y1, -z); start_Verts[3] = CIwFVec3(x1, y1, -z); start_Verts[4] = CIwFVec3(x1, y2, z); start_Verts[5] = CIwFVec3(x2, y2, z); start_Verts[6] = CIwFVec3(x2, y1, z); start_Verts[7] = CIwFVec3(x1, y1, z); IwGxSetMaterial(pMat); IwGxSetVertStream(start_Verts, 8); //IwGxSetColStream(s_Cols, 8); IwGxSetUVStream(s_UVs); IwGxDrawPrims(IW_GX_QUAD_STRIP, s_QuadStrip, 4); } float end_y1 = start_y1; float end_y2 = start_y2; float endWhScale = (float)((double)endTexture->GetWidth() / endTexture->GetHeight()); int16 endW = (end_y2 - end_y1) * endWhScale; int endMaxX = border_x2 - abs((float)(border_x2 - border_x1)*0.0097) - endW; int endMinX = start_x2; int16 end_x1 = (double)(endMaxX - endMinX)*ectoPercent + endMinX; int16 end_x2 = end_x1 + endW; { CIwMaterial* pMat = IW_GX_ALLOC_MATERIAL(); pMat->SetModulateMode(CIwMaterial::MODULATE_RGB); pMat->SetAlphaMode(CIwMaterial::ALPHA_BLEND); pMat->SetTexture(endTexture); int16 x1 = end_x1, x2 = end_x2; float y1 = end_y1, y2 = end_y2; end_Verts[0] = CIwFVec3(x1, y2, -z); end_Verts[1] = CIwFVec3(x2, y2, -z); end_Verts[2] = CIwFVec3(x2, y1, -z); end_Verts[3] = CIwFVec3(x1, y1, -z); end_Verts[4] = CIwFVec3(x1, y2, z); end_Verts[5] = CIwFVec3(x2, y2, z); end_Verts[6] = CIwFVec3(x2, y1, z); end_Verts[7] = CIwFVec3(x1, y1, z); IwGxSetMaterial(pMat); IwGxSetVertStream(end_Verts, 8); //IwGxSetColStream(s_Cols, 8); IwGxSetUVStream(s_UVs); IwGxDrawPrims(IW_GX_QUAD_STRIP, s_QuadStrip, 4); } float center_y1 = start_y1; float center_y2 = start_y2; int16 center_x1 = start_x2 - 1; int16 center_x2 = end_x1 + 1; { CIwMaterial* pMat = IW_GX_ALLOC_MATERIAL(); pMat->SetModulateMode(CIwMaterial::MODULATE_RGB); pMat->SetAlphaMode(CIwMaterial::ALPHA_BLEND); pMat->SetTexture(centerTexture); int16 x1 = center_x1, x2 = center_x2; float y1 = center_y1, y2 = center_y2; center_Verts[0] = CIwFVec3(x1, y2, -z); center_Verts[1] = CIwFVec3(x2, y2, -z); center_Verts[2] = CIwFVec3(x2, y1, -z); center_Verts[3] = CIwFVec3(x1, y1, -z); center_Verts[4] = CIwFVec3(x1, y2, z); center_Verts[5] = CIwFVec3(x2, y2, z); center_Verts[6] = CIwFVec3(x2, y1, z); center_Verts[7] = CIwFVec3(x1, y1, z); IwGxSetMaterial(pMat); IwGxSetVertStream(center_Verts, 8); //IwGxSetColStream(s_Cols, 8); IwGxSetUVStream(s_UVs); IwGxDrawPrims(IW_GX_QUAD_STRIP, s_QuadStrip, 4); } }