Changeset 549

Show
Ignore:
Timestamp:
03/26/08 12:14:42 (10 months ago)
Author:
phill
Message:

o Color dumping madness.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/maya2q3/bsp.cpp

    r548 r549  
    2121 
    2222#include "common.h" 
     23#include "bsp-local.h" 
    2324 
    2425namespace bsp 
    2526{ 
    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; 
    4127 
    4228class BspImporter 
     
    6147        MColorArray m_vertexLight; 
    6248        MIntArray m_vertexLightIDs; 
    63          
    64         MString m_SourceVertDataName; 
     49 
    6550        MIntArray m_sourceVertices; 
    6651 
     
    10792        void InitImporterObjects(); 
    10893 
    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 ); 
    11196 
    11297        void CreateMesh(); 
     
    155140 
    156141BspImporter::BspImporter( void ) 
    157         : m_SourceVertDataName( "sourceVertexIndex" ) 
    158142{ 
    159143        m_combineMeshes = false; 
     
    169153        MStringArray longNames, shortNames, formatNames; 
    170154 
    171         longNames.append( m_SourceVertDataName ); 
     155        longNames.append( BdSourceVertexAttr ); 
    172156        shortNames.append( "svi" ); 
    173157        formatNames.append( "int" ); 
    174158 
    175         stat = mesh.createBlindDataType( BdSourceVertex, longNames, shortNames, formatNames ); 
     159        stat = mesh.createBlindDataType( BdSourceVertexId, longNames, shortNames, formatNames ); 
    176160        check_status( stat ); 
    177161} 
     
    355339} 
    356340 
    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
     341void 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
    359343{ 
    360344        if( vertexCount == -1 ) 
     
    388372                m_lightmapUVIDs.append( index ); 
    389373                m_vertexLightIDs.append( index ); 
    390                 if( generateSourceIDs ) 
    391                         m_sourceVertices.append( index ); 
     374                m_sourceVertices.append( generateSourceIDs ? index : -1 ); 
    392375                 
    393376                index = baseVert + indices[firstIndex + i * 3 + 2]; 
     
    396379                m_lightmapUVIDs.append( index ); 
    397380                m_vertexLightIDs.append( index ); 
    398                 if( generateSourceIDs ) 
    399                         m_sourceVertices.append( index ); 
     381                m_sourceVertices.append( generateSourceIDs ? index : -1 ); 
    400382 
    401383                index = baseVert + indices[firstIndex + i * 3 + 1]; 
     
    404386                m_lightmapUVIDs.append( index ); 
    405387                m_vertexLightIDs.append( index ); 
    406                 if( generateSourceIDs ) 
    407                         m_sourceVertices.append( index ); 
     388                m_sourceVertices.append( generateSourceIDs ? index : -1 ); 
    408389 
    409390                if( shaderBin != -1 ) 
     
    488469 
    489470                                q3::PatchToMesh( p, tmpVerts, tmpIndices );  
    490                                 ParseTriangles( tmpVerts, tmpIndices, iter->first ); 
     471                                ParseTriangles( false, tmpVerts, tmpIndices, iter->first ); 
    491472                        } 
    492473                        else 
     
    494475                                const q3::dsurface_t &surf = surfs[surfIdxs[i]]; 
    495476 
    496                                 ParseTriangles( verts, indices, iter->first, surf.firstVert, 
     477                                ParseTriangles( true, verts, indices, iter->first, surf.firstVert, 
    497478                                        surf.numVerts, surf.firstIndex, surf.numIndexes ); 
    498479                        } 
     
    523504        check_status( stat ); 
    524505 
    525         MString texCoordSetName( "map1" ); 
     506        MString texCoordSetName( McTexCoordSet ); 
    526507        stat = mesh.setUVs( m_textureU, m_textureV, &texCoordSetName ); 
    527508        check_status( stat ); 
     
    529510        check_status( stat ); 
    530511 
    531         MString lightmapSetName( "LightmapCoords" ); 
     512        MString lightmapSetName( McLmapCoordSet ); 
    532513        stat = mesh.createUVSet( lightmapSetName ); 
    533514        check_status( stat ); 
     
    540521        check_status( stat ); 
    541522 
    542         MString vertexLightName( "VertexLight" ); 
     523        MString vertexLightName( McVertexLightSet ); 
    543524        stat = mesh.createColorSet( vertexLightName ); 
    544525        check_status( stat ); 
     
    550531        stat = mesh.updateSurface(); 
    551532        check_status( stat ); 
     533 
     534        MString sourceVertDataName( BdSourceVertexAttr ); 
    552535 
    553536        if( m_sourceVertices.length() ) 
     
    563546 
    564547                                stat = mesh.setIntBlindData( blindIndex, MFn::kMeshFaceVertComponent, 
    565                                         BdSourceVertex, m_SourceVertDataName, m_sourceVertices[iVert] ); 
     548                                        BdSourceVertexId, sourceVertDataName, m_sourceVertices[iVert] ); 
    566549                                check_status( stat ); 
    567550 
     
    909892                { 
    910893                        MGlobal::displayError( MString( ex.what() ) ); 
     894                        failed = true; 
    911895                } 
    912896                catch( ... ) 
  • trunk/maya2q3/common.h

    r548 r549  
    115115#include <maya/MFnTransform.h> 
    116116#include <maya/MItMeshPolygon.h> 
     117#include <maya/MItMeshFaceVertex.h> 
    117118#include <maya/MFnLambertShader.h> 
    118119#include <maya/MFnLight.h> 
  • trunk/maya2q3/maya2q3.vcproj

    r548 r549  
    854854                        > 
    855855                        <File 
     856                                RelativePath=".\bsp-colordump.cpp" 
     857                                > 
     858                        </File> 
     859                        <File 
    856860                                RelativePath=".\bsp-entities.cpp" 
     861                                > 
     862                        </File> 
     863                        <File 
     864                                RelativePath=".\bsp-local.h" 
    857865                                > 
    858866                        </File> 
  • trunk/maya2q3/maya_entry.cpp

    r547 r549  
    2626 
    2727static const char *g_vendor = "HermitWorks"; 
    28 static const char *g_version = "3.3.3"; 
     28static const char *g_version = "3.3.4"; 
    2929static const char *g_reqVer = "Any"; 
    3030 
     
    3939 
    4040        V( plugin.registerFileTranslator( bsp::g_translatorName, "", bsp::g_translatorCreator ) ); 
     41        V( plugin.registerCommand( bsp::g_clDmpCmdName, bsp::g_clDmpCmdCreator, bsp::g_clDmpSyntaxCreator ) ); 
    4142 
    4243#if MAYA_API_VERSION >= 700 
     
    7071        V( plugin.deregisterNode( shader::g_shaderTypeID ) ); 
    7172 
     73        V( plugin.deregisterCommand( bsp::g_clDmpCmdName ) ); 
    7274        V( plugin.deregisterFileTranslator( bsp::g_translatorName ) ); 
    7375 
  • trunk/maya2q3/plugins.h

    r182 r549  
    3131}; 
    3232 
    33 namespace x42 
     33namespace bsp 
    3434{ 
    3535 
     
    3737extern void* (CDECL *g_translatorCreator)( void ); 
    3838 
    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 ); 
     39extern const char *g_clDmpCmdName; 
     40extern void* (CDECL *g_clDmpCmdCreator)( void ); 
     41extern MSyntax (CDECL *g_clDmpSyntaxCreator)( void ); 
    5042 
    5143};