Ignore:
Timestamp:
04/24/09 18:00:06 (15 years ago)
Author:
mattausch
Message:

cleaned up algorithm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3361 r3362  
    628628 
    629629        if (0) LoadPompeiiFloor(); 
     630 
    630631#if 1 
    631632 
     
    642643        // sibenik positions 
    643644        VertexArray positions; 
    644          
     645        const float factor2 = 1.6f; 
    645646        // for buddha (lowres) 
    646         positions.push_back(Vector3(6.07307, 8.20723, 6.62)); 
    647         positions.push_back(Vector3(-17.1935, 11.1687, 8.8781)); 
    648         positions.push_back(Vector3(1.50032, 31.1943, 19.1f)); 
     647        positions.push_back(Vector3(6.07307, 8.20723, 6.62 - factor2)); 
     648        positions.push_back(Vector3(-17.1935, 11.1687, 8.8781 - factor2)); 
     649        //positions.push_back(Vector3(1.50032, 31.1943, 19.1f)); 
    649650 
    650651        // for happy buddha 
     
    655656        // for dragon 
    656657        //positions.push_back(Vector3(6.07307, 8.20723, 5.0f)); 
    657         //positions.push_back(Vector3(0, 0, -0.8)); 
     658        //positions.push_back(Vector3(0, 0, -0.8f)); 
    658659 
    659660#endif 
     
    661662        //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
    662663        Matrix4x4 transl = TranslationMatrix(positions[0]); 
    663          
     664        //LoadModel("dragon.dem", dynamicObjects); 
     665 
     666#if 1 
     667 
    664668        //LoadModel("hbuddha.dem", dynamicObjects); 
    665669        //LoadModel("horse.dem", dynamicObjects); 
    666         LoadModel("happy.dem", dynamicObjects); 
    667         //LoadModel("dragon.dem", dynamicObjects); 
     670        LoadModel("happy2.dem", dynamicObjects); 
    668671        //LoadModel("torus.dem", dynamicObjects); 
    669672        //LoadModel("venusm.dem", dynamicObjects); 
     
    678681        } 
    679682 
    680         /* 
     683 
    681684        const float rotAngle = M_PI / 2.0f; 
    682685        const Matrix4x4 rotMatrix = RotationXMatrix(rotAngle); 
     
    685688        // hack: second buddha 
    686689        dynamicObjects[0]->GetTransform()->MultMatrix(rotMatrix); 
    687         dynamicObjects[0]->GetTransform()->MultMatrix(scaleMatrix); 
    688  
    689         dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
     690        //dynamicObjects[0]->GetTransform()->MultMatrix(scaleMatrix); 
     691 
     692        /*dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
    690693        dynamicObjects[1]->GetTransform()->MultMatrix(scaleMatrix); 
    691694 
     
    698701 
    699702#endif 
    700  
     703#endif 
    701704        // hack 
    702705        resourceManager->mUseNormalMapping = false; 
     
    732735 
    733736        // set far plane based on scene extent 
    734         //farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal()); 
    735         farDist = 1000.0f; 
     737        farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal()); 
     738        //farDist = 1000.0f; 
    736739        camera->SetFar(farDist); 
    737740 
     
    11801183                buddha->GetTransform()->SetMatrix(trafo); 
    11811184 
     1185                const float rotAngle3 = M_PI / 2.0f; 
     1186                const Matrix4x4 rotMatrix3 = RotationZMatrix(rotAngle3); 
     1187 
     1188                // hack: second buddha 
     1189                buddha->GetTransform()->MultMatrix(rotMatrix3); 
     1190 
    11821191#if TODO // drop objects on ground floor 
    11831192                for (int i = 0; i < 10; ++ i) 
     
    11941203#endif 
    11951204 
    1196 #if 1 
    11971205                ///////////////////////// 
    11981206                //-- update animations 
    11991207 
     1208 
    12001209                //const float rotAngle = M_PI * 1e-3f; 
    1201                 const float rotAngle = 0.3f * M_PI / 180.0f; 
    1202                 //const float rotAngle = 0.6f * M_PI / 180.0f; 
     1210                //const float rotAngle = 0.3f * M_PI / 180.0f; 
     1211                const float rotAngle = 0.6f * M_PI / 180.0f; 
    12031212 
    12041213                Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); 
     
    12141223                const float moveSpeed = 1e-1f; 
    12151224                motionPath->Move(moveSpeed); 
    1216 #endif 
    12171225        } 
    12181226 
     
    14881496                } 
    14891497                 
    1490                 if (makeSnapShot) makeSnapShot = false; 
     1498                static int dummy = 0; 
     1499                if (makeSnapShot && (dummy ++ == 650)) makeSnapShot = false; 
    14911500 
    14921501                ShadowMap *sm = showShadowMap ? shadowMap : NULL; 
     
    20172026void RightMotionLight(int x, int y)  
    20182027{ 
    2019         float theta = 0.2f * M_PI * (xEyeBegin - x) / 180.0f; 
    2020         float phi = 0.2f * M_PI * (yMotionBegin - y) / 180.0f; 
     2028        const float theta = .2f * M_PI * (xEyeBegin - x) / 180.0f; 
     2029        const float phi   = .2f * M_PI * (yMotionBegin - y) / 180.0f; 
    20212030         
    20222031        Vector3 lightDir = light->GetDirection(); 
     
    20692078        Vector3 rVec(viewDir[0], viewDir[1], 0); 
    20702079         
    2071         Matrix4x4 rot = RotationZMatrix(M_PI * 0.5f); 
     2080        Matrix4x4 rot = RotationZMatrix(M_PI * .5f); 
    20722081        rVec = rot * rVec; 
    20732082         
    2074         pos -= rVec * (x - horizontalMotionBegin) * mouseMotion; 
     2083        pos    -= rVec * (x - horizontalMotionBegin) * mouseMotion; 
    20752084        pos[2] += (verticalMotionBegin - y) * mouseMotion; 
    20762085 
Note: See TracChangeset for help on using the changeset viewer.