Ignore:
Timestamp:
11/14/05 15:59:20 (19 years ago)
Author:
mattausch
Message:

worked on kd view space partitioning structure
worked on render simulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r387 r409  
    66#include "ViewCell.h" 
    77#include "Environment.h" 
     8#include "RenderSimulator.h" 
    89 
    910Preprocessor::Preprocessor(): 
    1011mKdTree(NULL), 
    11 mBspTree(NULL) 
     12mBspTree(NULL), 
     13mRenderSimulator(NULL) 
    1214{ 
    1315} 
     
    2022        DEL_PTR(mBspTree); 
    2123        DEL_PTR(mKdTree); 
     24 
     25        DEL_PTR(mRenderSimulator); 
    2226} 
    2327 
     
    5256 
    5357        if (strcmp(viewCellsStr, "bspTree") == 0) 
     58        { 
    5459                ViewCell::sHierarchy = ViewCell::BSP; 
     60        } 
    5561        else if (strcmp(viewCellsStr, "kdTree") == 0) 
     62        { 
    5663                ViewCell::sHierarchy = ViewCell::KD; 
     64        } 
    5765        else if (strcmp(viewCellsStr, "sceneDependent") == 0) 
    5866        { 
     
    6876} 
    6977 
     78RenderSimulator *Preprocessor::GetRenderSimulator() 
     79{ 
     80        if (mRenderSimulator) 
     81                return mRenderSimulator; 
     82 
     83    float objRenderCost = 0, vcOverhead = 0, moveSpeed = 0; 
     84 
     85        environment->GetFloatValue("Simulation.objRenderCost",objRenderCost); 
     86        environment->GetFloatValue("Simulation.vcOverhead", vcOverhead); 
     87        environment->GetFloatValue("Simulation.moveSpeed", moveSpeed); 
     88 
     89        if (ViewCell::sHierarchy = ViewCell::BSP) 
     90                mRenderSimulator = new BspViewCellRenderSimulator(objRenderCost, vcOverhead, moveSpeed, mBspTree); 
     91        else // KD view cells 
     92                mRenderSimulator = new KdViewCellRenderSimulator(objRenderCost, vcOverhead, moveSpeed, mKdTree); 
     93 
     94        return mRenderSimulator; 
     95} 
     96 
    7097void Preprocessor::DeleteViewCells() 
    7198{ 
    72         for (int i = 0; i < mViewCells.size(); ++ i) 
    73                 delete mViewCells[i]->GetMesh(); 
    74  
     99        for (int i = 0; i < (int)mViewCells.size(); ++ i) 
     100        { 
     101                Mesh *mesh = mViewCells[i]->GetMesh(); 
     102                DEL_PTR(mesh); 
     103        } 
    75104        CLEAR_CONTAINER(mViewCells); 
    76105} 
Note: See TracChangeset for help on using the changeset viewer.