Changeset 562

Show
Ignore:
Timestamp:
04/17/08 14:40:53 (9 months ago)
Author:
phill
Message:

o Light grid import - this time for real.

Files:

Legend:

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

    r561 r562  
    860860        MIntArray counts, indices; 
    861861 
    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++ ) 
     862        int bx = (int)bounds.x; 
     863        int by = (int)bounds.y; 
     864        int bz = (int)bounds.z; 
     865 
     866        for( int z = 0; z < bz; z++ ) 
     867        { 
     868                uint sliceBase = points.length(); 
     869 
     870                for( int y = 0; y < by; y++ ) 
     871                { 
     872                        for( int x = 0; x < bx; x++ ) 
    867873                        { 
    868                                 points.append( MFloatPoint( q3::Q3VecToMaya( mins + vec3c( x, y, z ) ) ) ); 
     874                                points.append( MFloatPoint( q3::Q3VecToMaya( 
     875                                        mins + size * vec3c( (float)x, (float)y, (float)z ) ) ) ); 
    869876                        } 
    870877                } 
     878 
     879                for( int y = 0; y < by - 1; y++ ) 
     880                { 
     881                        uint rowBase = sliceBase + bx * y; 
     882 
     883                        for( int x = 0; x < bx - 1; x++ ) 
     884                        { 
     885                                indices.append( rowBase + x ); 
     886                                indices.append( rowBase + x + 1 ); 
     887                                indices.append( rowBase + x + 1 + bx ); 
     888                                indices.append( rowBase + x + bx ); 
     889                                counts.append( 4 ); 
     890                        } 
     891                } 
    871892        } 
    872893 
    873894        MFnMesh mesh; 
    874         MObject meshObj = mesh.create( points.length(), counts.length(), points, counts, indices, MObject::kNullObj, &stat ); 
     895        MObject meshObj = mesh.create( points.length(), counts.length(), 
     896                points, counts, indices, MObject::kNullObj, &stat ); 
    875897        check_status( stat ); 
    876898