Changeset 561
- Timestamp:
- 04/17/08 12:00:20 (9 months ago)
- Files:
-
- trunk/common/math-vector.h (modified) (1 diff)
- trunk/maya2q3/bsp-local.h (modified) (1 diff)
- trunk/maya2q3/bsp.cpp (modified) (5 diffs)
- trunk/maya2q3/maya_entry.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/common/math-vector.h
r535 r561 140 140 inline vec3 abs( const vec3 &v ) { return vec3c( abs( v.x ), abs( v.y ), abs( v.z ) ); } 141 141 142 inline vec3 ceil( const vec3 &v ) { return vec3c( ceil( v.x ), ceil( v.y ), ceil( v.z ) ); } 143 inline vec3 floor( const vec3 &v ) { return vec3c( floor( v.x ), floor( v.y ), floor( v.z ) ); } 144 142 145 inline bool equal( const vec3 &v0, const vec3 &v1, float tol ) { return fabsf( v0.x - v1.x ) <= tol && fabsf( v0.y - v1.y ) <= tol && fabsf( v0.z - v1.z ) <= tol; } 143 146 trunk/maya2q3/bsp-local.h
r549 r561 31 31 Literal EkMessage = "message"; 32 32 Literal EkDeluxeMapping = "deluxemapping"; 33 Literal EkLightGridSize = "gridsize"; 33 34 Literal EkOrigin = "origin"; 34 35 Literal EkAngle = "angle"; trunk/maya2q3/bsp.cpp
r550 r561 61 61 MDagPathArray m_lightPaths; 62 62 63 MDagPath m_lightGridPoints; 64 63 65 std::vector< std::pair< int, int > > m_shaderMap; 64 66 std::vector< std::vector< int > > m_shaderFaceNums; … … 105 107 void CreateShaderQuickSelects(); 106 108 void CreateQuickSelect( const MSelectionList &sel, const MString &name ); 109 110 void ImportLightGridPoints(); 107 111 108 112 void ParseEntities(); … … 742 746 check_status( stat ); 743 747 } 748 749 { 750 MDagPath path = m_lightGridPoints; 751 752 stat = path.pop(); 753 check_status( stat ); 754 755 MObject obj = path.node( &stat ); 756 check_status( stat ); 757 758 stat = fnParent.addChild( obj ); 759 check_status( stat ); 760 } 744 761 } 745 762 … … 824 841 } 825 842 843 void BspImporter::ImportLightGridPoints() 844 { 845 MStatus stat; 846 847 std::vector< q3::dmodel_t > models = ReadLump< q3::dmodel_t >( q3::LUMP_MODELS ); 848 if( models.size() < 1 ) 849 throw std::exception( "Missing world model record." ); 850 const q3::dmodel_t &wm = models[0]; 851 852 vec3 size = m_entities[0].AsVec3( EkLightGridSize, vec3c( 64, 64, 128 ) ); 853 854 vec3 mins = size * ceil( wm.mins / size ); 855 vec3 maxs = size * floor( wm.maxs / size ); 856 857 vec3 bounds = floor( (maxs - mins) / size ) + vec3c( 1 ); 858 859 MFloatPointArray points; 860 MIntArray counts, indices; 861 862 for( float z = 0; z < bounds.z; z++ ) 863 { 864 for( float y = 0; y < bounds.y; y++ ) 865 { 866 for( float x = 0; x < bounds.x; x++ ) 867 { 868 points.append( MFloatPoint( q3::Q3VecToMaya( mins + vec3c( x, y, z ) ) ) ); 869 } 870 } 871 } 872 873 MFnMesh mesh; 874 MObject meshObj = mesh.create( points.length(), counts.length(), points, counts, indices, MObject::kNullObj, &stat ); 875 check_status( stat ); 876 877 stat = mesh.updateSurface(); 878 check_status( stat ); 879 880 MDagPath path; 881 stat = mesh.getPath( path ); 882 check_status( stat ); 883 884 m_lightGridPoints = path; 885 886 stat = path.pop(); 887 check_status( stat ); 888 889 MFnDagNode fnParent( path, &stat ); 890 check_status( stat ); 891 892 fnParent.setName( MString( "lightgrid" ), &stat ); 893 check_status( stat ); 894 } 895 826 896 void BspImporter::Import( std::istream &stm, const MObject &parentXform, const char *basePath ) 827 897 { … … 844 914 845 915 ImportEntityLights(); 916 ImportLightGridPoints(); 846 917 847 918 GroupNodes( parentXform ); trunk/maya2q3/maya_entry.cpp
r551 r561 26 26 27 27 static const char *g_vendor = "HermitWorks"; 28 static const char *g_version = "3.3. 6";28 static const char *g_version = "3.3.7"; 29 29 static const char *g_reqVer = "Any"; 30 30
