Ignore:
Timestamp:
02/17/09 19:21:52 (15 years ago)
Author:
mattausch
Message:

surpressed blur, worked on object placing in sibenik (why performance worse than vienna??)

File:
1 edited

Legend:

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

    r3315 r3316  
    286286float viewCellsScaleFactor = 1.0f; 
    287287 
     288float maxConvergence = 2000.0f; 
     289 
     290 
    288291 
    289292////////////// 
     
    377380inline float KeyShift() { return keyForwardMotion * elapsedTime * 1e-3f; } 
    378381 
    379 void CreateAnimation(); 
     382void CreateAnimation(const Vector3 &pos); 
    380383 
    381384SceneQuery *GetOrCreateSceneQuery(); 
     
    390393 
    391394void LoadOrUpdatePVSs(const Vector3 &pos); 
     395 
     396void CreateNewInstance(SceneEntity *parent, const Vector3 &pos); 
     397 
     398 
     399///////////// 
    392400 
    393401string envFileName = "default.env"; 
     
    626634 
    627635#if 1 
    628         const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
     636 
     637#if 0 
     638        VertexArray positions; 
     639        positions.push_back(Vector3(478.398f, 268.0f, 181.3)); 
     640        positions.push_back(Vector3(470.461, 268.543, 181.7)); 
     641        positions.push_back(Vector3(499.648, 264.358, 181.7)); 
     642        positions.push_back(Vector3(487.913, 285.162, 181.7)); 
     643 
     644#else 
     645 
     646        VertexArray positions; 
     647        //positions.push_back(Vector3(6.07307, 8.20723, 6.7)); 
     648        positions.push_back(Vector3(6.07307, 8.20723, 6.62)); 
     649        positions.push_back(Vector3(-17.1935, 11.1687, 8.8781)); 
     650        //positions.push_back(Vector3(499.648, 264.358, 181.7)); 
     651        //positions.push_back(Vector3(487.913, 285.162, 181.7)); 
     652 
     653#endif 
     654 
    629655        //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
    630         Matrix4x4 transl = TranslationMatrix(sceneCenter); 
     656        Matrix4x4 transl = TranslationMatrix(positions[0]); 
    631657         
    632658        LoadModel("hbuddha.dem", dynamicObjects); 
     
    635661        buddha->GetTransform()->SetMatrix(transl); 
    636662 
    637         for (int i = 0; i < 10; ++ i) 
    638         { 
    639                 SceneEntity *ent = new SceneEntity(*buddha); 
    640                 resourceManager->AddSceneEntity(ent); 
    641  
    642                 Vector3 offs = Vector3::ZERO(); 
    643  
    644                 offs.x = RandomValue(.0f, 50.0f); 
    645                 offs.y = RandomValue(.0f, 50.0f); 
    646  
    647                 Vector3 newPos = sceneCenter + offs; 
    648  
    649                 transl = TranslationMatrix(newPos); 
    650                 Transform3 *transform = resourceManager->CreateTransform(transl); 
    651  
    652                 ent->SetTransform(transform); 
    653                 dynamicObjects.push_back(ent); 
    654         } 
     663         
     664        for (size_t i = 1; i < positions.size(); ++ i) 
     665        { 
     666                CreateNewInstance(buddha, positions[i]); 
     667        } 
     668 
    655669#endif 
    656670 
     
    706720        preetham = new SkyPreetham(turbitity, skyDome); 
    707721 
    708         CreateAnimation(); 
     722        CreateAnimation(positions[0]); 
    709723 
    710724 
     
    11511165 
    11521166                //const float rotAngle = M_PI * 1e-3f; 
    1153                 const float rotAngle = 0.3f * M_PI / 180.0f; 
    1154                 //const float rotAngle = 1.0f * M_PI / 180.0f; 
     1167                //const float rotAngle = 0.3f * M_PI / 180.0f; 
     1168                const float rotAngle = 0.6f * M_PI / 180.0f; 
    11551169 
    11561170                Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); 
     1171                // hack: second buddha 
    11571172                dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
    11581173 
    1159                 const float moveSpeed = 5e-3f; 
     1174                //const float moveSpeed = 5e-3f; 
     1175                const float moveSpeed = 1e-1f; 
    11601176                motionPath->Move(moveSpeed); 
    11611177        } 
     
    14121428                deferredShader->SetUseToneMapping(useHDR); 
    14131429                deferredShader->SetUseAntiAliasing(useAntiAliasing); 
     1430                deferredShader->SetMaxConvergence(maxConvergence); 
    14141431 
    14151432 
     
    15821599                traverser->SetUseOptimization(useOptimization); 
    15831600                break;*/ 
     1601        case 'o': 
     1602        case 'O': 
     1603                if (maxConvergence > 100.0f) 
     1604                        maxConvergence = 1.0f; 
     1605                else  
     1606                        maxConvergence = 5000.0f; 
     1607 
     1608                cout << "max convergence: " << maxConvergence << endl; 
     1609 
     1610                break; 
    15841611        case 'l': 
    15851612        case 'L': 
     
    25952622 
    25962623 
    2597 void CreateAnimation() 
    2598 { 
    2599         const float radius = 5.0f; 
    2600         //const Vector3 center(480.398f, 268.364f, 181.3); 
    2601         const Vector3 center(480.398f, 269.364f, 181.3); 
     2624void CreateAnimation(const Vector3 &pos) 
     2625{ 
     2626        //const float b = 5.0f; const float a = 1.5f; 
     2627        const float a = 5.0f; const float b = 1.5f; 
    26022628 
    26032629        VertexArray vertices; 
    26042630 
    2605         /*for (int i = 0; i < 360; ++ i) 
    2606         { 
    2607                 float angle = (float)i * M_PI / 180.0f; 
    2608  
    2609                 Vector3 offs = Vector3(cos(angle) * radius, sin(angle) * radius, 0); 
     2631        for (int i = 0; i < 360; ++ i) 
     2632        { 
     2633                const float angle = (float)i * M_PI / 180.0f; 
     2634 
     2635                Vector3 offs = Vector3(cos(angle) * a, sin(angle) * b, 0); 
     2636                vertices.push_back(pos + offs); 
     2637        } 
     2638 
     2639        /*for (int i = 0; i < 5; ++ i) 
     2640        { 
     2641                Vector3 offs = Vector3(i, 0, 0); 
     2642                vertices.push_back(center + offs); 
     2643        } 
     2644         
     2645        for (int i = 0; i < 5; ++ i) 
     2646        { 
     2647                Vector3 offs = Vector3(4 - i, 0, 0); 
    26102648                vertices.push_back(center + offs); 
    26112649        }*/ 
    26122650 
    2613         for (int i = 0; i < 5; ++ i) 
    2614         { 
    2615                 Vector3 offs = Vector3(i, 0, 0); 
    2616                 vertices.push_back(center + offs); 
    2617         } 
    2618  
    2619          
    2620         for (int i = 0; i < 5; ++ i) 
    2621         { 
    2622                 Vector3 offs = Vector3(4 -i, 0, 0); 
    2623                 vertices.push_back(center + offs); 
    2624         } 
    2625  
    26262651        motionPath = new MotionPath(vertices); 
    26272652} 
     2653 
    26282654 
    26292655/** This function returns the number of visible pixels of a 
     
    28052831        if (viewCellsTree) UpdatePvs(pos); 
    28062832} 
     2833 
     2834 
     2835void CreateNewInstance(SceneEntity *parent, const Vector3 &pos) 
     2836{ 
     2837        SceneEntity *ent = new SceneEntity(*parent); 
     2838        resourceManager->AddSceneEntity(ent); 
     2839 
     2840        Matrix4x4 transl = TranslationMatrix(pos); 
     2841        Transform3 *transform = resourceManager->CreateTransform(transl); 
     2842 
     2843        ent->SetTransform(transform); 
     2844        dynamicObjects.push_back(ent); 
     2845        //Debug << "positions: " << newPos << endl; 
     2846} 
Note: See TracChangeset for help on using the changeset viewer.