Changeset 549
- Timestamp:
- 03/26/08 12:14:42 (10 months ago)
- Files:
-
- trunk/maya2q3/bsp-colordump.cpp (added)
- trunk/maya2q3/bsp-local.h (added)
- trunk/maya2q3/bsp.cpp (modified) (17 diffs)
- trunk/maya2q3/common.h (modified) (1 diff)
- trunk/maya2q3/maya2q3.vcproj (modified) (1 diff)
- trunk/maya2q3/maya_entry.cpp (modified) (3 diffs)
- trunk/maya2q3/plugins.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/maya2q3/bsp.cpp
r548 r549 21 21 22 22 #include "common.h" 23 #include "bsp-local.h" 23 24 24 25 namespace bsp 25 26 { 26 27 typedef const char *const Literal;28 29 Literal EkClassName = "classname";30 Literal EkMessage = "message";31 Literal EkDeluxeMapping = "deluxemapping";32 Literal EkOrigin = "origin";33 Literal EkAngle = "angle";34 Literal EkLight = "light";35 Literal EkColor = "_color";36 37 Literal EcWorldSpawn = "worldspawn";38 Literal EcLight = "light";39 40 const int BdSourceVertex = 100;41 27 42 28 class BspImporter … … 61 47 MColorArray m_vertexLight; 62 48 MIntArray m_vertexLightIDs; 63 64 MString m_SourceVertDataName; 49 65 50 MIntArray m_sourceVertices; 66 51 … … 107 92 void InitImporterObjects(); 108 93 109 void ParseTriangles( const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices, int shaderBin,110 int firstVert = 0, int vertexCount = -1, int firstIndex = 0, int indexCount = -1 , bool generateSourceIDs = true);94 void ParseTriangles( bool generateSourceIDs, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices, int shaderBin, 95 int firstVert = 0, int vertexCount = -1, int firstIndex = 0, int indexCount = -1 ); 111 96 112 97 void CreateMesh(); … … 155 140 156 141 BspImporter::BspImporter( void ) 157 : m_SourceVertDataName( "sourceVertexIndex" )158 142 { 159 143 m_combineMeshes = false; … … 169 153 MStringArray longNames, shortNames, formatNames; 170 154 171 longNames.append( m_SourceVertDataName);155 longNames.append( BdSourceVertexAttr ); 172 156 shortNames.append( "svi" ); 173 157 formatNames.append( "int" ); 174 158 175 stat = mesh.createBlindDataType( BdSourceVertex , longNames, shortNames, formatNames );159 stat = mesh.createBlindDataType( BdSourceVertexId, longNames, shortNames, formatNames ); 176 160 check_status( stat ); 177 161 } … … 355 339 } 356 340 357 void BspImporter::ParseTriangles( const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices,358 int shaderBin, int firstVert, int vertexCount, int firstIndex, int indexCount , bool generateSourceIDs)341 void BspImporter::ParseTriangles( bool generateSourceIDs, const std::vector< q3::drawVert_t > &verts, const std::vector< int > &indices, 342 int shaderBin, int firstVert, int vertexCount, int firstIndex, int indexCount ) 359 343 { 360 344 if( vertexCount == -1 ) … … 388 372 m_lightmapUVIDs.append( index ); 389 373 m_vertexLightIDs.append( index ); 390 if( generateSourceIDs ) 391 m_sourceVertices.append( index ); 374 m_sourceVertices.append( generateSourceIDs ? index : -1 ); 392 375 393 376 index = baseVert + indices[firstIndex + i * 3 + 2]; … … 396 379 m_lightmapUVIDs.append( index ); 397 380 m_vertexLightIDs.append( index ); 398 if( generateSourceIDs ) 399 m_sourceVertices.append( index ); 381 m_sourceVertices.append( generateSourceIDs ? index : -1 ); 400 382 401 383 index = baseVert + indices[firstIndex + i * 3 + 1]; … … 404 386 m_lightmapUVIDs.append( index ); 405 387 m_vertexLightIDs.append( index ); 406 if( generateSourceIDs ) 407 m_sourceVertices.append( index ); 388 m_sourceVertices.append( generateSourceIDs ? index : -1 ); 408 389 409 390 if( shaderBin != -1 ) … … 488 469 489 470 q3::PatchToMesh( p, tmpVerts, tmpIndices ); 490 ParseTriangles( tmpVerts, tmpIndices, iter->first );471 ParseTriangles( false, tmpVerts, tmpIndices, iter->first ); 491 472 } 492 473 else … … 494 475 const q3::dsurface_t &surf = surfs[surfIdxs[i]]; 495 476 496 ParseTriangles( verts, indices, iter->first, surf.firstVert,477 ParseTriangles( true, verts, indices, iter->first, surf.firstVert, 497 478 surf.numVerts, surf.firstIndex, surf.numIndexes ); 498 479 } … … 523 504 check_status( stat ); 524 505 525 MString texCoordSetName( "map1");506 MString texCoordSetName( McTexCoordSet ); 526 507 stat = mesh.setUVs( m_textureU, m_textureV, &texCoordSetName ); 527 508 check_status( stat ); … … 529 510 check_status( stat ); 530 511 531 MString lightmapSetName( "LightmapCoords");512 MString lightmapSetName( McLmapCoordSet ); 532 513 stat = mesh.createUVSet( lightmapSetName ); 533 514 check_status( stat ); … … 540 521 check_status( stat ); 541 522 542 MString vertexLightName( "VertexLight");523 MString vertexLightName( McVertexLightSet ); 543 524 stat = mesh.createColorSet( vertexLightName ); 544 525 check_status( stat ); … … 550 531 stat = mesh.updateSurface(); 551 532 check_status( stat ); 533 534 MString sourceVertDataName( BdSourceVertexAttr ); 552 535 553 536 if( m_sourceVertices.length() ) … … 563 546 564 547 stat = mesh.setIntBlindData( blindIndex, MFn::kMeshFaceVertComponent, 565 BdSourceVertex , m_SourceVertDataName, m_sourceVertices[iVert] );548 BdSourceVertexId, sourceVertDataName, m_sourceVertices[iVert] ); 566 549 check_status( stat ); 567 550 … … 909 892 { 910 893 MGlobal::displayError( MString( ex.what() ) ); 894 failed = true; 911 895 } 912 896 catch( ... ) trunk/maya2q3/common.h
r548 r549 115 115 #include <maya/MFnTransform.h> 116 116 #include <maya/MItMeshPolygon.h> 117 #include <maya/MItMeshFaceVertex.h> 117 118 #include <maya/MFnLambertShader.h> 118 119 #include <maya/MFnLight.h> trunk/maya2q3/maya2q3.vcproj
r548 r549 854 854 > 855 855 <File 856 RelativePath=".\bsp-colordump.cpp" 857 > 858 </File> 859 <File 856 860 RelativePath=".\bsp-entities.cpp" 861 > 862 </File> 863 <File 864 RelativePath=".\bsp-local.h" 857 865 > 858 866 </File> trunk/maya2q3/maya_entry.cpp
r547 r549 26 26 27 27 static const char *g_vendor = "HermitWorks"; 28 static const char *g_version = "3.3. 3";28 static const char *g_version = "3.3.4"; 29 29 static const char *g_reqVer = "Any"; 30 30 … … 39 39 40 40 V( plugin.registerFileTranslator( bsp::g_translatorName, "", bsp::g_translatorCreator ) ); 41 V( plugin.registerCommand( bsp::g_clDmpCmdName, bsp::g_clDmpCmdCreator, bsp::g_clDmpSyntaxCreator ) ); 41 42 42 43 #if MAYA_API_VERSION >= 700 … … 70 71 V( plugin.deregisterNode( shader::g_shaderTypeID ) ); 71 72 73 V( plugin.deregisterCommand( bsp::g_clDmpCmdName ) ); 72 74 V( plugin.deregisterFileTranslator( bsp::g_translatorName ) ); 73 75 trunk/maya2q3/plugins.h
r182 r549 31 31 }; 32 32 33 namespace x4233 namespace bsp 34 34 { 35 35 … … 37 37 extern void* (CDECL *g_translatorCreator)( void ); 38 38 39 extern const char *g_cmdName; 40 extern void* (CDECL *g_cmdCreator)( void ); 41 extern MSyntax (CDECL *g_cmdSyntaxCreator)( void ); 42 43 }; 44 45 namespace bsp 46 { 47 48 extern const char *g_translatorName; 49 extern void* (CDECL *g_translatorCreator)( void ); 39 extern const char *g_clDmpCmdName; 40 extern void* (CDECL *g_clDmpCmdCreator)( void ); 41 extern MSyntax (CDECL *g_clDmpSyntaxCreator)( void ); 50 42 51 43 };
