void SbWaxGraph::Render() { // Apply the shader m_pShader->Apply(); // Render the cube m_pWaxModel->Render(); // Render the graph RenderGraph(); MtMatrix4 m4Transform = m_pWaxModel->GetWorldTransform(); MtVector3 v3Translate = m4Transform.GetTranslation(); MtVector3 v3Pos( 0, 0, 1 ); v3Pos = v3Pos * m4Transform; HlDraw::RenderLine( v3Translate, v3Pos, RsColour::GreenColour() ); v3Pos = MtVector3( 1, 0, 0 ); v3Pos = v3Pos * m4Transform; HlDraw::RenderLine( v3Translate, v3Pos, RsColour::RedColour() ); v3Pos = MtVector3( 0, 1, 0 ); v3Pos = v3Pos * m4Transform; HlDraw::RenderLine( v3Translate, v3Pos, RsColour::BlueColour() ); }
void CModelViewRender::CalcScaleValues() { DWORD retval; GETBOUNDINGBOXPARAMS gbbp; Vec3 v3Pos(0.0f, 0.0f, 0.0f); Vec3 v3Extents; EulerAngle v3Rotation; gbbp.position = &v3Pos; gbbp.extents = &v3Extents; gbbp.rotation = &v3Rotation; static DWORD msgHash_GetBoundingBox = CHashString(_T("GetBoundingBox")).GetUniqueID(); retval = m_ToolBox->SendMessage(msgHash_GetBoundingBox, sizeof(gbbp), &gbbp, &m_hszModelName); if (retval != MSG_HANDLED) { m_ToolBox->Log( LOGERROR, _T("%s(%i): GetBoundingBox not handled.\n"), __FILE__, __LINE__ ); assert(0); } m_fZoomDistance = 0.0; if ( gbbp.extents ) { if (v3Extents.x > v3Extents.z) m_fZoomDistance = v3Extents.x; else m_fZoomDistance = v3Extents.z; m_fZoomDistance *= 3.0f; } m_fScaleZoom = (m_fZoomDistance / 6000); m_fScaleOffset = m_fZoomDistance / 480; // set model in the center of the view m_v3Position.SetX(v3Pos.GetX() * -1); m_v3Position.SetY(v3Pos.GetY() * -1); // TODO: fit model in the view }
void CActorInstance::ShakeProcess() { if (m_dwShakeTime) { D3DXVECTOR3 v3Pos(0.0f, 0.0f, 0.0f); DWORD dwCurTime=ELTimer_GetMSec(); if (m_dwShakeTime<dwCurTime) { m_dwShakeTime=0; } else { int nShakeSize=10; switch (rand()%2) { case 0:v3Pos.x+=rand()%nShakeSize;break; case 1:v3Pos.x-=rand()%nShakeSize;break; } switch (rand()%2) { case 0:v3Pos.y+=rand()%nShakeSize;break; case 1:v3Pos.y-=rand()%nShakeSize;break; } switch (rand()%2) { case 0:v3Pos.z+=rand()%nShakeSize;break; case 1:v3Pos.z-=rand()%nShakeSize;break; } } m_worldMatrix._41 += v3Pos.x; m_worldMatrix._42 += v3Pos.y; m_worldMatrix._43 += v3Pos.z; } }