Ignore:
Timestamp:
04/01/07 00:02:16 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/pathmap/FlexVertex.cpp

    r2197 r2304  
    22#include ".\flexvertex.h" 
    33 
    4 unsigned int FlexVertex::posByteOffset(0); 
    5 unsigned int FlexVertex::normalByteOffset(12); 
    6 unsigned int FlexVertex::diffuseByteOffset(24); 
    7 unsigned int FlexVertex::specularByteOffset(28); 
    8 unsigned int FlexVertex::texByteOffset[16] = {  32, 40, 48, 56, 64, 72, 80, 88, 
    9                                                                                                 96, 104, 112, 120, 128, 136, 144, 152}; 
    10 unsigned int FlexVertex::nTex = 2; 
     4FlexFormat* FlexVertex::format = NULL; 
    115 
    12 void FlexVertex::setFormat(D3DVERTEXELEMENT9* decl) 
     6void FlexVertex::setFormat(FlexFormat* format) 
     7{ 
     8        FlexVertex::format = format; 
     9} 
     10 
     11FlexFormat::FlexFormat() 
     12: 
     13posByteOffset(0), 
     14normalByteOffset(12), 
     15diffuseByteOffset(24), 
     16specularByteOffset(28), 
     17nTex(2) 
     18{ 
     19        unsigned int ii[16] = {32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152}; 
     20        for(int iu=0; iu<16; iu++) 
     21                texByteOffset[iu] = ii[iu]; 
     22} 
     23 
     24void FlexVertexArray::setFormat(D3DVERTEXELEMENT9* decl) 
    1325{ 
    1426        int i=0; 
    15         nTex = 0; 
     27        format.nTex = 0; 
    1628        while(decl[i].Type != D3DDECLTYPE_UNUSED) 
    1729        { 
    1830                if(decl[i].Usage == D3DDECLUSAGE_POSITION) 
    19                         posByteOffset = decl[i].Offset; 
     31                        format.posByteOffset = decl[i].Offset; 
    2032                if(decl[i].Usage == D3DDECLUSAGE_NORMAL) 
    21                         normalByteOffset = decl[i].Offset; 
     33                        format.normalByteOffset = decl[i].Offset; 
    2234                if(decl[i].Usage == D3DDECLUSAGE_COLOR) 
    2335                { 
    2436                        if(decl[i].UsageIndex == 0) 
    25                                 diffuseByteOffset = decl[i].Offset; 
     37                                format.diffuseByteOffset = decl[i].Offset; 
    2638                        if(decl[i].UsageIndex == 1) 
    27                                 specularByteOffset = decl[i].Offset; 
     39                                format.specularByteOffset = decl[i].Offset; 
    2840                } 
    2941                if(decl[i].Usage == D3DDECLUSAGE_TEXCOORD) 
    3042                { 
    31                         texByteOffset[decl[i].UsageIndex] = decl[i].Offset; 
    32                         if(decl[i].UsageIndex >= nTex) 
    33                                 nTex = decl[i].UsageIndex+1; 
     43                        format.texByteOffset[decl[i].UsageIndex] = decl[i].Offset; 
     44                        if(decl[i].UsageIndex >= format.nTex) 
     45                                format.nTex = decl[i].UsageIndex+1; 
    3446                } 
    3547                i++; 
    3648        } 
     49        FlexVertex::setFormat(&format); 
    3750} 
Note: See TracChangeset for help on using the changeset viewer.