Changeset 438 for cafu/trunk
- Timestamp:
- 12/01/11 10:47:06 (6 months ago)
- Location:
- cafu/trunk
- Files:
-
- 5 modified
-
Games/DeathMatch/Code/HumanPlayer.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/StaticDetailModel.cpp (modified) (2 diffs)
-
Games/DeathMatch/Code/StaticDetailModel.hpp (modified) (1 diff)
-
Libs/Models/AnimPose.cpp (modified) (1 diff)
-
Libs/Models/AnimPose.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/Games/DeathMatch/Code/HumanPlayer.cpp
r426 r438 260 260 Vector3fT GuiAxisY; 261 261 262 if (!GuiEnt->GetGuiPlane( GuiOrigin, GuiAxisX, GuiAxisY)) return false;262 if (!GuiEnt->GetGuiPlane(0, GuiOrigin, GuiAxisX, GuiAxisY) && !GuiEnt->GetGuiPlane(GuiOrigin, GuiAxisX, GuiAxisY)) return false; 263 263 264 264 -
cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.cpp
r428 r438 299 299 Vector3fT GuiAxisY; 300 300 301 if ( m_Model->GetGuiPlane(GuiOrigin, GuiAxisX, GuiAxisY))301 if (Pose->GetGuiPlane(0, GuiOrigin, GuiAxisX, GuiAxisY) || m_Model->GetGuiPlane(GuiOrigin, GuiAxisX, GuiAxisY)) 302 302 { 303 303 #if 1 … … 415 415 416 416 417 bool EntStaticDetailModelT::GetGuiPlane(unsigned int GFNr, Vector3fT& GuiOrigin, Vector3fT& GuiAxisX, Vector3fT& GuiAxisY) const 418 { 419 if (!m_Model->GetSharedPose(m_SequNr, m_FrameNr)->GetGuiPlane(GFNr, GuiOrigin, GuiAxisX, GuiAxisY)) return false; 420 421 // Okay, got the plane. Now transform it from model space into world space. 422 GuiOrigin=scale(GuiOrigin, 25.4f); 423 GuiOrigin=GuiOrigin.GetRotX( -float(State.Pitch )/8192.0f*45.0f); 424 GuiOrigin=GuiOrigin.GetRotY( float(State.Bank )/8192.0f*45.0f); 425 GuiOrigin=GuiOrigin.GetRotZ(90.0f-float(State.Heading)/8192.0f*45.0f); 426 427 GuiAxisX=scale(GuiAxisX, 25.4f); 428 GuiAxisX=GuiAxisX.GetRotX( -float(State.Pitch )/8192.0f*45.0f); 429 GuiAxisX=GuiAxisX.GetRotY( float(State.Bank )/8192.0f*45.0f); 430 GuiAxisX=GuiAxisX.GetRotZ(90.0f-float(State.Heading)/8192.0f*45.0f); 431 432 GuiAxisY=scale(GuiAxisY, 25.4f); 433 GuiAxisY=GuiAxisY.GetRotX( -float(State.Pitch )/8192.0f*45.0f); 434 GuiAxisY=GuiAxisY.GetRotY( float(State.Bank )/8192.0f*45.0f); 435 GuiAxisY=GuiAxisY.GetRotZ(90.0f-float(State.Heading)/8192.0f*45.0f); 436 437 // The GuiOrigin must also be translated. 438 GuiOrigin+=State.Origin.AsVectorOfFloat(); 439 440 return true; 441 } 442 443 417 444 int EntStaticDetailModelT::IsPlayingAnim(lua_State* LuaState) 418 445 { -
cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.hpp
r429 r438 60 60 /// GuiAxisX and GuiAxisY parameters were filled-out properly. 61 61 bool GetGuiPlane(Vector3fT& GuiOrigin, Vector3fT& GuiAxisX, Vector3fT& GuiAxisY) const; 62 bool GetGuiPlane(unsigned int GFNr, Vector3fT& GuiOrigin, Vector3fT& GuiAxisX, Vector3fT& GuiAxisY) const; 62 63 63 64 -
cafu/trunk/Libs/Models/AnimPose.cpp
r435 r438 717 717 718 718 719 bool AnimPoseT::GetGuiPlane(unsigned int GFNr, Vector3fT& Origin, Vector3fT& AxisX, Vector3fT& AxisY) const 720 { 721 // if (m_Model.GetDlodModel() && LodDist >= m_Model.GetDlodDist()) 722 // { 723 // return m_DlodPose->GetGuiPlane(GFNr, Origin, AxisX, AxisY); 724 // } 725 726 Recache(); 727 728 if (GFNr >= m_Model.GetGuiFixtures().Size()) return false; 729 730 const CafuModelT::GuiFixtureT& GF=m_Model.GetGuiFixtures()[GFNr]; 731 Vector3fT Points[3]; 732 733 for (unsigned int PointNr=0; PointNr<3; PointNr++) 734 { 735 if (!m_Model.IsMeshNrOK (GF, PointNr)) return false; 736 if (!m_Model.IsVertexNrOK(GF, PointNr)) return false; 737 738 Points[PointNr]=m_MeshInfos[GF.Points[PointNr].MeshNr].Vertices[GF.Points[PointNr].VertexNr].Pos; 739 } 740 741 AxisX =(Points[1]-Points[0])*GF.Scale[0]; 742 AxisY =(Points[2]-Points[0])*GF.Scale[1]; 743 Origin=Points[0] + AxisX*GF.Trans[0] + AxisY*GF.Trans[1]; 744 745 // // It's pretty easy to derive this matrix geometrically, see my TechArchive note from 2006-08-22. 746 // MatrixT M(AxisX.x/640.0f, AxisY.x/480.0f, 0.0f, Origin.x, 747 // AxisX.y/640.0f, AxisY.y/480.0f, 0.0f, Origin.y, 748 // AxisX.z/640.0f, AxisY.z/480.0f, 0.0f, Origin.z, 749 // 0.0f, 0.0f, 0.0f, 1.0f); 750 751 return true; 752 } 753 754 719 755 bool AnimPoseT::TraceRay(int SkinNr, const Vector3fT& RayOrigin, const Vector3fT& RayDir, TraceResultT& Result) const 720 756 { -
cafu/trunk/Libs/Models/AnimPose.hpp
r428 r438 126 126 void Draw(int SkinNr, float LodDist) const; 127 127 128 /// Returns the origin, x-axis and y-axis vectors for the given Gui fixture. 129 /// The return value indicates whether the vectors could successfully be returned in the reference parameters 130 /// (the method can fail if e.g. the model has no such Gui fixture or the Gui fixture is improperly specified). 131 bool GetGuiPlane(unsigned int GFNr, Vector3fT& Origin, Vector3fT& AxisX, Vector3fT& AxisY) const; 132 128 133 /// Traces a ray against this model in this pose, and returns whether it was hit. 129 134 /// The ray for the trace is defined by RayOrigin + RayDir*Fraction, where Fraction is a scalar >= 0.
