Changeset 535
- Timestamp:
- 03/05/08 15:32:26 (10 months ago)
- Files:
-
- trunk/bin/win32/release (8.5)/bin (modified) (1 prop)
- trunk/bin/win32/release (8.5)/bin/maya2q3.mll (added)
- trunk/bin/win32/release (8.5)/bin/maya2q3.pdb (added)
- trunk/bin/win32/release (8.5)/maya2q3.mll (deleted)
- trunk/bin/win32/release (8.5)/maya2q3.pdb (deleted)
- trunk/common/math-vector.h (modified) (2 diffs)
- trunk/maya2q3/bsp-patches.cpp (added)
- trunk/maya2q3/bsp.cpp (modified) (5 diffs)
- trunk/maya2q3/maya2q3.vcproj (modified) (8 diffs)
- trunk/maya2q3/q3util.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bin/win32/release (8.5)/bin
- Property svn:ignore changed from
x42maya.exp
x42maya.lib
to
x42maya.exp
x42maya.lib
maya2q3.exp
maya2q3.lib
- Property svn:ignore changed from
trunk/common/math-vector.h
r211 r535 84 84 inline vec2 abs( const vec2 &v ) { return vec2c( abs( v.x ), abs( v.y ) ); } 85 85 86 inline bool equal( const vec2 &v0, const vec2 &v1, float tol ) { return fabsf( v0.x - v1.x ) <= tol && fabsf( v0.y - v1.y ) <= tol; } 87 86 88 struct vec3 87 89 { … … 138 140 inline vec3 abs( const vec3 &v ) { return vec3c( abs( v.x ), abs( v.y ), abs( v.z ) ); } 139 141 142 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 140 144 __declspec( align( 16 ) ) struct vec4 141 145 { trunk/maya2q3/bsp.cpp
r495 r535 34 34 MIntArray m_faceVertIndices; 35 35 36 std::vector< q3::Patch > m_patchStaging; 37 36 38 BspMeshData( void ); 37 39 … … 41 43 42 44 private: 45 void AppendTriangles( const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices, 46 int firstVert = 0, int vertexCount = -1, int firstIndex = 0, int indexCount = -1 ); 43 47 void AppendFace( const q3::dsurface_t &surf, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices ); 44 48 void AppendMesh( const q3::dsurface_t &surf, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices ); 49 void AppendPatch( const q3::dsurface_t &surf, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices ); 50 51 void BakePatches(); 45 52 }; 46 53 … … 52 59 } 53 60 61 void BspMeshData::AppendTriangles( const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices, 62 int firstVert, int vertexCount, int firstIndex, int indexCount ) 63 { 64 if( vertexCount == -1 ) 65 vertexCount = (int)verts.size(); 66 if( indexCount == -1 ) 67 indexCount = (int)indices.size(); 68 69 int baseVert = (int)m_verts.length(); 70 for( int i = 0; i < vertexCount; i++ ) 71 m_verts.append( MPoint( verts[firstVert + i].xyz ) ); 72 73 //ToDo: collapse out coplanar edges (?) 74 75 int numTris = indexCount / 3; 76 for( int i = 0; i < numTris; i++ ) 77 { 78 m_faceVertIndices.append( baseVert + indices[firstIndex + i * 3 + 0] ); 79 m_faceVertIndices.append( baseVert + indices[firstIndex + i * 3 + 2] ); 80 m_faceVertIndices.append( baseVert + indices[firstIndex + i * 3 + 1] ); 81 82 m_faceCounts.append( 3 ); 83 } 84 } 85 54 86 void BspMeshData::AppendFace( const q3::dsurface_t &surf, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices ) 55 87 { 56 int baseVert = (int)m_verts.length(); 57 for( int i = 0; i < surf.numVerts; i++ ) 58 m_verts.append( MPoint( verts[surf.firstVert + i].xyz ) ); 59 60 //ToDo: collapse out coplanar edges (?) 61 62 for( int i = 0; i < surf.numIndexes / 3; i++ ) 63 { 64 m_faceVertIndices.append( baseVert + indices[surf.firstIndex + i * 3 + 0] ); 65 m_faceVertIndices.append( baseVert + indices[surf.firstIndex + i * 3 + 2] ); 66 m_faceVertIndices.append( baseVert + indices[surf.firstIndex + i * 3 + 1] ); 67 68 m_faceCounts.append( 3 ); 69 } 88 AppendTriangles( verts, indices, surf.firstVert, surf.numVerts, surf.firstIndex, surf.numIndexes ); 70 89 } 71 90 72 91 void BspMeshData::AppendMesh( const q3::dsurface_t &surf, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices ) 73 92 { 74 int baseVert = (int)m_verts.length(); 75 for( int i = 0; i < surf.numVerts; i++ ) 76 m_verts.append( MPoint( verts[surf.firstVert + i].xyz ) ); 77 78 //ToDo: collapse out coplanar edges (?) 79 80 for( int i = 0; i < surf.numIndexes / 3; i++ ) 81 { 82 m_faceVertIndices.append( baseVert + indices[surf.firstIndex + i * 3 + 0] ); 83 m_faceVertIndices.append( baseVert + indices[surf.firstIndex + i * 3 + 2] ); 84 m_faceVertIndices.append( baseVert + indices[surf.firstIndex + i * 3 + 1] ); 85 86 m_faceCounts.append( 3 ); 87 } 93 AppendTriangles( verts, indices, surf.firstVert, surf.numVerts, surf.firstIndex, surf.numIndexes ); 94 } 95 96 void BspMeshData::AppendPatch( const q3::dsurface_t &surf, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices ) 97 { 98 q3::Patch p = q3::SubdividePatchToGrid( surf.patchWidth, surf.patchHeight, &verts[surf.firstVert] ); 99 m_patchStaging.push_back( p ); 100 } 101 102 void BspMeshData::BakePatches() 103 { 104 q3::StitchAllPatches( m_patchStaging ); 105 q3::FixSharedVertexLodError( m_patchStaging ); 106 107 std::vector< int > indices; 108 std::vector< q3::drawVert_t > verts; 109 110 for( uint i = 0; i < m_patchStaging.size(); i++ ) 111 { 112 q3::PatchToMesh( m_patchStaging[i], verts, indices ); 113 AppendTriangles( verts, indices ); 114 } 115 116 m_patchStaging.clear(); 88 117 } 89 118 … … 135 164 break; 136 165 166 case q3::MST_PATCH: 167 AppendPatch( surfs[i], verts, indices ); 168 break; 169 137 170 default: 138 171 warn( "Ignoring surface." ); … … 143 176 MObject BspMeshData::CreateMesh( void ) 144 177 { 178 BakePatches(); 179 145 180 MStatus stat; 146 181 trunk/maya2q3/maya2q3.vcproj
r534 r535 18 18 <Configuration 19 19 Name="Debug (6.0)|Win32" 20 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName) "20 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)\bin" 21 21 IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" 22 22 ConfigurationType="2" … … 109 109 <Configuration 110 110 Name="Release (6.0)|Win32" 111 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName) "111 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)\bin" 112 112 IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" 113 113 ConfigurationType="2" … … 198 198 <Configuration 199 199 Name="Debug (7.0)|Win32" 200 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName) "200 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)\bin" 201 201 IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" 202 202 ConfigurationType="2" … … 289 289 <Configuration 290 290 Name="Release (7.0)|Win32" 291 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName) "291 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)\bin" 292 292 IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" 293 293 ConfigurationType="2" … … 378 378 <Configuration 379 379 Name="Debug (8.5)|Win32" 380 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName) "380 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)\bin" 381 381 IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" 382 382 ConfigurationType="2" … … 470 470 <Configuration 471 471 Name="Release (8.5)|Win32" 472 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName) "472 OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)\bin" 473 473 IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" 474 474 ConfigurationType="2" … … 554 554 Name="VCPostBuildEventTool" 555 555 Description="Copying to Maya plugins directory." 556 CommandLine="copy "$(OutDir)\$(ProjectName).mll" "$(ProgramFiles)\Alias\Maya7.0\bin\plug-ins"
copy "$(ProjectDir)\AEQ3ShaderTemplate.mel" "$(ProgramFiles)\Alias\Maya7.0\scripts\AETemplates"
copy "$(ProjectDir)\maya2q3.mel" "$(ProgramFiles)\Alias\Maya7.0\scripts\others"
" 557 ExcludedFromBuild="true" 556 CommandLine="copy "$(OutDir)\$(ProjectName).mll" "C:\Program Files (x86)\Autodesk\Maya8.5\bin\plug-ins"
copy "$(ProjectDir)\AEQ3ShaderTemplate.mel" "C:\Program Files (x86)\Autodesk\Maya8.5\scripts\AETemplates"
copy "$(ProjectDir)\maya2q3.mel" "C:\Program Files (x86)\Autodesk\Maya8.5\scripts\others"
" 558 557 /> 559 558 </Configuration> … … 568 567 > 569 568 <File 569 RelativePath=".\bsp-patches.cpp" 570 > 571 </File> 572 <File 570 573 RelativePath=".\bsp.cpp" 571 574 > trunk/maya2q3/q3util.h
r182 r535 91 91 MString GetTagName( const MDagPath &path ); 92 92 93 struct Patch 94 { 95 vec3 lodOrigin; 96 float lodRadius; 97 int lodFixed; 98 bool lodStitched; 99 100 int width; 101 int height; 102 std::vector< float > widthLodError; 103 std::vector< float > heightLodError; 104 std::vector< q3::drawVert_t > verts; 105 106 uint meshIdx; 107 }; 108 109 void StitchAllPatches( std::vector< Patch > &patches ); 110 void FixSharedVertexLodError( std::vector< Patch > &patches ); 111 Patch SubdividePatchToGrid( int width, int height, const drawVert_t points[] ); 112 113 void PatchToMesh( const Patch &patch, std::vector< q3::drawVert_t > &out_verts, std::vector< int > &out_indices ); 114 93 115 }; 94 116
