Просмотр исходного кода

Merge pull request #117 from paulsapps/installer

down scale pc models to correct size
paulsapps 11 лет назад
Родитель
Сommit
70e3cfe2bb

+ 1 - 0
QGearsMain/include/data/QGearsHRCFile.h

@@ -40,6 +40,7 @@ namespace QGears
     class HRCFile : public Ogre::Resource
     {
     public:
+        static const float kDownScaler;
 
         HRCFile( Ogre::ResourceManager *creator, const String &name
                 ,Ogre::ResourceHandle handle, const String &group

+ 2 - 0
QGearsMain/src/data/QGearsAFileSerializer.cpp

@@ -27,6 +27,7 @@ THE SOFTWARE.
 
 #include <OgreException.h>
 #include <OgreLogManager.h>
+#include "data/QGearsHRCFile.h"
 
 namespace QGears
 {
@@ -73,6 +74,7 @@ namespace QGears
     {
         readObject( stream, pDest.root_rotation );
         readObject( stream, pDest.root_translation );
+        pDest.root_translation = pDest.root_translation / HRCFile::kDownScaler;
         readVector( stream, pDest.bone_rotations, m_header.bone_count );
     }
 

+ 3 - 1
QGearsMain/src/data/QGearsHRCFile.cpp

@@ -40,7 +40,8 @@ THE SOFTWARE.
 namespace QGears
 {
     //---------------------------------------------------------------------
-    const String    HRCFile::RESOURCE_TYPE( "QGearsHRCFile" );
+    /*static*/ const String    HRCFile::RESOURCE_TYPE( "QGearsHRCFile" );
+    /*static*/ const float     HRCFile::kDownScaler = 33.0f;
 
     //---------------------------------------------------------------------
     HRCFile::HRCFile( Ogre::ResourceManager *creator
@@ -83,6 +84,7 @@ namespace QGears
         Ogre::DataStreamPtr stream( Ogre::ResourceGroupManager::getSingleton().openResource( mName, mGroup, true, this ) );
         serializer.importHRCFile( stream, this );
 
+
         const String skeleton_file_name( getSkeletonFileName() );
         Ogre::SkeletonManager &skeleton_manager( Ogre::SkeletonManager::getSingleton() );
         m_skeleton = skeleton_manager.getByName( skeleton_file_name, mGroup );

+ 1 - 1
QGearsMain/src/data/QGearsHRCFileSerializer.cpp

@@ -131,7 +131,7 @@ namespace QGears
         Block::const_iterator it( bone_block.begin() );
         pDest.name          = *(it++);
         pDest.parent        = *(it++);
-        pDest.length        = Ogre::StringConverter::parseReal( *(it++) );
+        pDest.length = Ogre::StringConverter::parseReal(*(it++)) / HRCFile::kDownScaler;
 
         Ogre::StringVector rsd_list( Ogre::StringUtil::split( *it ) );
         size_t rsd_count( Ogre::StringConverter::parseUnsignedInt( rsd_list.front() ) );

+ 5 - 3
QGearsMain/src/data/QGearsPFile.cpp

@@ -31,6 +31,7 @@ THE SOFTWARE.
 
 #include "common/QGearsStringUtil.h"
 #include "data/QGearsPFileSerializer.h"
+#include "data/QGearsHRCFile.h"
 
 namespace QGears
 {
@@ -208,14 +209,15 @@ namespace QGears
                       ,t( group.texture_coordinate_start_index
                          +polygon.vertex[i] );
                 Ogre::Vector3 pos( m_vertices[ v ] );
-                mo.position( ( STATIC_ROTATION *  pos ) + bone_position );
+                mo.position((STATIC_ROTATION *  (pos / HRCFile::kDownScaler)) + bone_position);
                 mo.colour( m_vertex_colors[ v ] );
                 mo.normal( STATIC_ROTATION * m_normals[ n ] );
                 if( group.has_texture )
                 {
-                    mo.textureCoord( m_texture_coordinates[t] );
+                    mo.textureCoord(m_texture_coordinates[t]);
                 }
-                mo.bone( index, bone_handle ); mo.index( index++ );
+                mo.bone( index, bone_handle );
+                mo.index( index++ );
             }
         }
         mo.end();