Changeset 3335 for GTP


Ignore:
Timestamp:
03/09/09 18:45:10 (15 years ago)
Author:
mattausch
Message:

adding torus

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp

    r3323 r3335  
    523523        vector<Geometry *>::const_iterator it, it_end = mGeometry.end(); 
    524524 
     525        Material defaultMaterial; 
     526 
    525527        for (it = mGeometry.begin(); it != it_end; ++ it) 
    526528        { 
     529 
     530                /////////////////////// 
     531                //-- write geometry 
     532 
    527533                WriteGeometry(ofile, *it); 
    528534 
    529535                 
    530536                ///////// 
    531                 //-- material 
    532  
    533                 Material *mat = (*it)->mMaterial; 
    534  
    535                 if (!mat) cerr << "error: no material specified!!" << endl; 
     537                //-- write material 
     538 
     539                Material *mat = (*it)->mMaterial ? (*it)->mMaterial : &defaultMaterial; 
    536540 
    537541                ofile.write(reinterpret_cast<char *>(&mat->texture), sizeof(int)); 
     
    540544                //bool cullFaceEnabled = false; 
    541545                bool cullFaceEnabled = true; 
    542                  
     546 
    543547                ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 
    544548                ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 
     
    547551                bool hasMaterial = true; 
    548552                ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 
    549          
     553 
    550554                SimpleVec ambient, diffuse, spec, emm; 
    551555 
    552556                ambient.x = ambient.y = ambient.z = 0.2f; 
    553557                //diffuse.x = diffuse.y = diffuse.z = 1.0f; 
    554                 diffuse.x = mat->rgb[0]; diffuse.y =mat->rgb[1]; diffuse.z = mat->rgb[2]; 
     558                diffuse.x = mat->rgb[0]; diffuse.y = mat->rgb[1]; diffuse.z = mat->rgb[2]; 
    555559                spec.x = spec.y = spec.z = .0f; 
    556560                emm = spec; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp

    r3275 r3335  
    486486                Material *mat = (*it)->mMaterial; 
    487487 
    488                 if (!mat) cerr << "error: no material specified!!" << endl; 
     488                if (!mat) cerr << "error: no material associated with this geometry!!" << endl; 
    489489 
    490490                ofile.write(reinterpret_cast<char *>(&mat->texture), sizeof(int)); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3325 r3335  
    657657        Matrix4x4 transl = TranslationMatrix(positions[0]); 
    658658         
    659         LoadModel("hbuddha.dem", dynamicObjects); 
     659        //LoadModel("hbuddha.dem", dynamicObjects); 
     660        LoadModel("torus.dem", dynamicObjects); 
    660661        //LoadModel("venusm.dem", dynamicObjects); 
    661662 
     
    11741175                dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
    11751176 
     1177                const float rotAngle2 = 0.6f * M_PI / 180.0f; 
     1178 
     1179                Matrix4x4 rotMatrix2 = RotationZMatrix(rotAngle); 
     1180                // hack: second buddha 
     1181                dynamicObjects[3]->GetTransform()->MultMatrix(rotMatrix2); 
     1182 
     1183 
    11761184                //const float moveSpeed = 5e-3f; 
    11771185                const float moveSpeed = 1e-1f; 
Note: See TracChangeset for help on using the changeset viewer.