Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

skin.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                     skin.h  -  Skeletal controlled submeshes
00003                              -------------------
00004     begin                : Wed Sep 18 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, skin.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NESKIN_H
00028 #define __NESKIN_H
00029 
00030 
00037 #include "base.h"
00038 #include "submesh.h"
00039 #include "nemath.h"
00040 
00041 
00042 namespace NeoEngine
00043 {
00044 
00045 
00046 // External classes
00047 class Skeleton;
00048 
00049 
00054 class NEOENGINE_API BoneInfluence
00055 {
00056     public:
00057 
00059         int                                           m_iBoneID;
00060 
00062         float                                         m_fWeight;
00063 
00065         Vector3d                                    m_kOffset;
00066 };
00067 
00068 
00073 class NEOENGINE_API SkinVertex
00074 {
00075     public:
00076 
00078         int                                           m_iNumInfluences;
00079 
00081         BoneInfluence                                *m_pkInfluences;
00082 
00085                                                       SkinVertex() : m_iNumInfluences(0), m_pkInfluences(0) {}
00086         
00089                                                      ~SkinVertex();
00090 };
00091 
00092 
00097 class NEOENGINE_API Skin : public RefCounter
00098 {
00099     public:
00100 
00102         int                                           m_iNumVertices;
00103 
00105         SkinVertex                                 *m_pkSkinVertices;
00106 
00108         VertexBufferPtr                             m_pkVertices;
00109 
00110 
00113                                                       Skin( int iNumVertices = 0, SkinVertex *pkSkinVertices = 0, VertexBufferPtr pkVertices = 0 ) : m_iNumVertices( iNumVertices ), m_pkSkinVertices( pkSkinVertices ), m_pkVertices( pkVertices ) {}
00114 
00118         virtual                                      ~Skin();
00119 };
00120 
00121 
00122 //Define smart pointer interface
00123 SmartPointer( Skin );
00124 
00125 
00130 class NEOENGINE_API SkeletalSubMesh : public SubMesh
00131 {
00132     protected:
00133 
00137         virtual void                                  UpdateData() { WeightVertices(); }
00138 
00139 
00140     public:
00141 
00143         Skeleton                                     *m_pkSkeleton;
00144     
00146         SkinPtr                                       m_pkSkin;
00147 
00148 
00151                                                       SkeletalSubMesh();
00152 
00156                                                       SkeletalSubMesh( const SkeletalSubMesh &rkSubMesh );
00157 
00160         virtual                                      ~SkeletalSubMesh();
00161 
00165         inline virtual VertexBufferPtr               &GetVertexBuffer() { if( m_bNeedUpdate ) { WeightVertices(); m_bNeedUpdate = false; } return m_pkVertices; }
00166 
00170         void                                          WeightVertices();
00171 
00176         virtual void                                  Update( float fDeltaTime ) { m_bNeedUpdate = true; }
00177 
00181         virtual SubMesh                              *Duplicate() const;
00182 
00186         virtual unsigned int                          GetType() const { return SKELETALSUBMESH; }
00187 };
00188 
00189 
00190 };
00191 
00192 
00193 #endif

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5