Changeset 8

Show
Ignore:
Timestamp:
30.1.2006 15:20:35 (3 years ago)
Author:
blackhex
Message:

Aktualizace makefile

Location:
SoTerrain
Files:
3 added
9 modified

Legend:

Unmodified
Added
Removed
  • SoTerrain/SoTerrain.kateproject

    r6 r8  
    55[Dir include/geomipmapping] 
    66Dirs= 
    7 Files=SoSimpleGeoMipmapTerrain.h 
     7Files=SoSimpleGeoMipmapTerrain.h/SbGeoMipmapPrimitives.h 
    88 
    99[Dir include/profiler] 
     
    2121[Dir src] 
    2222Dirs=profiler/roam/geomipmapping 
    23 Files=main.cpp 
     23Files=SoSimpleGeoMipmapTerrainTest.cpp/SoSimpleROAMTerrainTest.cpp 
    2424 
    2525[Dir src/geomipmapping] 
    2626Dirs= 
    27 Files=SoSimpleGeoMipmapTerrain.cpp 
     27Files=SoSimpleGeoMipmapTerrain.cpp/SbGeoMipmapPrimitives.cpp 
    2828 
    2929[Dir src/profiler] 
  • SoTerrain/TODO

    r1 r8  
    1 1. Vypocet normal pro smooth shading. 
    2    - priorita: nizka 
    3  
    4 2. Generovani triangle-stripu. 
    5    - priorita: nizka 
    6  
    7 3. Inteligentnejsi vypocet bounding-boxu. 
    8    - priorita: detail 
    9  
    10 4. Geomorphing 
    11    - priorita: nizka 
    12  
    13 5. Zjednoduseni odvracenych stran kopcu 
    14    - priorita: stredni 
    15  
    16  
    17 memprof 
    18 oprofile 
    19 leaktracer 
  • SoTerrain/include/geomipmapping/SoSimpleGeoMipmapTerrain.h

    r6 r8  
    2929/////////////////////////////////////////////////////////////////////////////// 
    3030 
     31// OpenInventor includy 
     32#include <Inventor/fields/SoSFBool.h> 
     33#include <Inventor/fields/SoSFInt32.h> 
     34#include <Inventor/nodes/SoShape.h> 
     35#include <Inventor/elements/SoCoordinateElement.h> 
     36#include <Inventor/elements/SoTextureCoordinateElement.h> 
     37#include <Inventor/elements/SoViewVolumeElement.h> 
     38#include <Inventor/actions/SoGLRenderAction.h> 
     39 
     40// lokalni includy 
     41#include <geomipmapping/SbGeoMipmapPrimitives.h> 
     42#include <profiler/PrProfiler.h> 
     43#include <debug.h> 
     44 
     45class SoSimpleGeoMipmapTerrain : public SoShape 
     46{ 
     47  SO_NODE_HEADER(SoSimpleGeoMipmapTerrain); 
     48  public: 
     49    /* Metody */ 
     50    static void initClass(); 
     51    SoSimpleGeoMipmapTerrain(); 
     52    /* Pole. */ 
     53    SoSFInt32 mapSize; 
     54    SoSFInt32 tileSize; 
     55    SoSFInt32 pixelError; 
     56    SoSFBool frustrumCulling; 
     57    SoSFBool freeze; 
     58  protected: 
     59    /* Metody */ 
     60    virtual void generatePrimitives(SoAction * action); 
     61    virtual void computeBBox(SoAction * action, SbBox3f & box, 
     62      SbVec3f & center); 
     63    inline bool isInViewVolume(SbGeoMipmapTile * tile); 
     64    inline float computePriority(SbGeoMipmapTile * tile); 
     65    /* Datove polozky. */ 
     66    const SoCoordinateElement * coords; 
     67    const SoTextureCoordinateElement * texture_coords; 
     68    const SbViewVolume * view_volume; 
     69    /* Konstanty. */ 
     70    static const int DEFAULT_PIXEL_ERROR = 20; 
     71  private: 
     72    /* Metody */ 
     73    virtual ~SoSimpleGeoMipmapTerrain(); 
     74}; 
     75 
    3176#endif 
  • SoTerrain/include/profiler/PrProfiler.h

    r6 r8  
    2929/////////////////////////////////////////////////////////////////////////////// 
    3030 
     31#ifdef PROFILE 
     32 
    3133#include <cstdlib> 
    3234#include <vector> 
    3335#include <fstream> 
    34 #include <time.h> 
     36#ifdef __GNUC__ 
     37  #include <sys/time.h> 
     38#else 
     39  #include <time.h> 
     40#endif 
    3541 
    3642#include <iostream> 
     
    120126/* Makra pro snadnejsi pouzivani PrProfiler. Jsou funkcni pouze tehdy, je-li 
    121127definovana promenna preprocesoru PROFILE. */ 
    122 #ifdef PROFILE 
    123   /** Urci zacatek profilovani. 
    124   Zacatek profilovani algoritmu s nazvem \p name. */ 
    125   #define PR_START_PROFILE(name) \ 
    126     static int name##_id = PrProfiler::getAlgId(#name); \ 
    127     PrProfiler::startProfile(name##_id) 
    128   /** Urci zacatek profilovani (objektova verze). 
    129   Zacatek profilovani algoritmu s nazvem \p name patriciho objektu \p object. */ 
    130   #define PR_START_OBJ_PROFILE(name, object) \ 
    131     static int name##_id = PrProfiler::getAlgId(#name); \ 
    132     PrProfiler::startProfile(name##_id, object) 
    133   /** Urci konec profilovani. 
    134   Konec profilovani algoritmu s nazvem \p name. */ 
    135   #define PR_STOP_PROFILE(name) PrProfiler::stopProfile(name##_id) 
    136   /** Urci konec profilovani (objektova verze). 
    137   Konec profilovani algoritmu s nazvem \p name patriciho objektu \p object. */ 
    138   #define PR_STOP_OBJ_PROFILE(name, object) \ 
    139     PrProfiler::stopProfile(name##_id, object) 
    140   /** Inicializace profileru. 
    141   Incializace celeho profileru, je nutno zavolat pred jeho pouzitim, 
    142   nelepe na zacatku programu. */ 
    143   #define PR_INIT_PROFILER() PrProfiler::initProfiler() 
    144   /** Tisk vysledku profilovani. 
    145   Vytiskne vysledky profilovani na konec souboru \p filename ve formatu 
    146   definovanem v PrProfiler::printResults(). */ 
    147   #define PR_PRINT_RESULTS(filename) PrProfiler::printResults(filename) 
     128/** Urci zacatek profilovani. 
     129Zacatek profilovani algoritmu s nazvem \p name. */ 
     130#define PR_START_PROFILE(name) \ 
     131  static int name##_id = PrProfiler::getAlgId(#name); \ 
     132  PrProfiler::startProfile(name##_id) 
     133/** Urci zacatek profilovani (objektova verze). 
     134Zacatek profilovani algoritmu s nazvem \p name patriciho objektu \p object. */ 
     135#define PR_START_OBJ_PROFILE(name, object) \ 
     136  static int name##_id = PrProfiler::getAlgId(#name); \ 
     137  PrProfiler::startProfile(name##_id, object) 
     138/** Urci konec profilovani. 
     139Konec profilovani algoritmu s nazvem \p name. */ 
     140#define PR_STOP_PROFILE(name) PrProfiler::stopProfile(name##_id) 
     141/** Urci konec profilovani (objektova verze). 
     142Konec profilovani algoritmu s nazvem \p name patriciho objektu \p object. */ 
     143#define PR_STOP_OBJ_PROFILE(name, object) \ 
     144  PrProfiler::stopProfile(name##_id, object) 
     145/** Inicializace profileru. 
     146Incializace celeho profileru, je nutno zavolat pred jeho pouzitim, 
     147nelepe na zacatku programu. */ 
     148#define PR_INIT_PROFILER() PrProfiler::initProfiler() 
     149/** Tisk vysledku profilovani. 
     150Vytiskne vysledky profilovani na konec souboru \p filename ve formatu 
     151definovanem v PrProfiler::printResults(). */ 
     152#define PR_PRINT_RESULTS(filename) PrProfiler::printResults(filename) 
     153 
    148154#else 
    149   #define PR_START_PROFILE(name) 
    150   #define PR_START_OBJ_PROFILE(name, object) 
    151   #define PR_STOP_PROFILE(name) 
    152   #define PR_STOP_OBJ_PROFILE(name, object) 
    153   #define PR_INIT_PROFILER() 
    154   #define PR_PRINT_RESULTS(filename) 
     155 
     156struct PrResult {}; 
     157class PrProfiler {}; 
     158 
     159#define PR_START_PROFILE(name) 
     160#define PR_START_OBJ_PROFILE(name, object) 
     161#define PR_STOP_PROFILE(name) 
     162#define PR_STOP_OBJ_PROFILE(name, object) 
     163#define PR_INIT_PROFILER() 
     164#define PR_PRINT_RESULTS(filename) 
     165 
    155166#endif 
    156167 
  • SoTerrain/include/roam/SoSimpleROAMTerrain.h

    r6 r8  
    4646 
    4747// lokalni includy 
     48#include <roam/SbROAMPrimitives.h> 
    4849#include <roam/SbROAMSplitQueue.h> 
    4950#include <roam/SbROAMMergeQueue.h> 
  • SoTerrain/makefile

    r6 r8  
    44 
    55# Promenne specificke pro projekt 
    6 TARGET = ./SoSimpleROAMTerrainTest 
     6ROAM_TARGET = ./SoSimpleROAMTerrainTest 
     7GEO_TARGET = ./SoSimpleGeoMipmapTerrainTest 
     8TARGETS = $(GEO_TARGET) $(ROAM_TARGET) 
    79 
    810INC = ./include/ 
     
    1113DOC = ./doc/html/ 
    1214 
    13 APP = $(OBJ)SoSimpleROAMTerrainTest.o 
    14 TER = $(OBJ)SoSimpleROAMTerrain.o 
    15 SQE = $(OBJ)SbROAMSplitQueue.o 
    16 MQE = $(OBJ)SbROAMMergeQueue.o 
    17 PRI = $(OBJ)SbROAMPrimitives.o 
     15ROAM_APP = $(OBJ)SoSimpleROAMTerrainTest.o 
     16ROAM_TER = $(OBJ)SoSimpleROAMTerrain.o 
     17ROAM_SQ = $(OBJ)SbROAMSplitQueue.o 
     18ROAM_MQ = $(OBJ)SbROAMMergeQueue.o 
     19ROAM_PR = $(OBJ)SbROAMPrimitives.o 
     20GEO_APP = $(OBJ)SoSimpleGeoMipmapTerrainTest.o 
     21GEO_TER = $(OBJ)SoSimpleGeoMipmapTerrain.o 
     22GEO_PR = $(OBJ)SbGeoMipmapPrimitives.o 
    1823PRF = $(OBJ)PrProfiler.o 
    1924 
    20 OBJS = $(APP) $(TER) $(SQE) $(MQE) $(PRI) 
     25ROAM_OBJS = $(ROAM_APP) $(ROAM_TER) $(ROAM_SQ) $(ROAM_MQ) $(ROAM_PR) 
     26GEO_OBJS = $(GEO_APP) $(GEO_TER) $(GEO_PR) 
     27OBJS = $(ROAM_OBJS) $(GEO_OBJS) $(PRF) 
    2128 
    2229CXXFLAGS = -ansi -I`soqt-config --cppflags` -I./include/ -Wall 
    2330LDFLAGS = `soqt-config --libs --ldflags` `simage-config --ldflags --libs` 
    2431 
     32.PHONY : doc clean geo_run roam_run 
     33.DEFAULT : all 
     34 
    2535# Cile prekladu 
    26 $(TARGET) : CXXFLAGS += -O3 
    27 $(TARGET) : LDFLAGS += -O3 
    28 $(TARGET) : $(OBJS) 
     36all : CXXFLAGS += -O3 
     37all : LDFLAGS += -O3 
     38all : $(TARGETS) 
    2939        @echo "Version for release build." 
    30         @$(LD) $^ $(LDFLAGS) -o $(TARGET) 
    3140 
    3241debug : CXXFLAGS += -DDEBUG -ggdb -g3 
    3342debug : LDFLAGS += -DDEBUG -ggdb -g3 
    34 debug : $(OBJS) 
     43debug : $(TARGETS) 
    3544        @echo "Version for debugging build." 
    36         @$(LD) $^ $(LDFLAGS) -o $(TARGET) 
    3745 
    3846profile : CXXFLAGS += -DPROFILE -O3 -pg -g 
    3947profile : LDFLAGS += -DPROFILE -O3 -pg -g 
    40 profile : $(OBJS) $(PRF) 
     48profile : GEO_OBJS += $(PRF) 
     49profile : ROAM_OBJS += $(PRF) 
     50profile : $(TARGETS) 
    4151        @echo "Version for profiling build." 
    42         @$(LD) $^ $(LDFLAGS) -o $(TARGET) 
    4352 
    44 clean : OBJS += $(PRF) 
    4553clean : 
    4654        @echo "Removing compiled files..." 
    47         @rm -f $(TARGET) 
     55        @rm -f $(TARGETS) 
    4856        @rm -f $(OBJS) 
    4957        @rm -f -r $(DOC) 
    5058 
    51 doc :: 
     59doc : 
    5260        echo "Generating documentation..." 
    5361        @doxygen doxyfile 
    5462 
    55 release : $(TARGET) doc 
     63release : $(TARGETS) doc 
    5664        @echo "Making release tarball..." 
    57         @tar -cjf SoTerrain.tar.bz2 makefile doxyfile README TODO  doc images include \ 
    58            src scripts SoTerrain.kateproject 
     65        @tar -cjf SoTerrain.tar.bz2 makefile doxyfile README TODO doc/html include \ 
     66           src scripts SoTerrain.kateproject SoTerrain.vcproj SoTerrain.sln \ 
     67           images/heightmaps/ps_height_1k.png images/textures/ps_texture_1k.png 
    5968 
    60 run : $(TARGET) 
     69roam_run : $(ROAM_TARGET) 
    6170        @echo "Running test application..." 
    62         $(TARGET) images/heightmaps/ps_height_1k.png images/textures/ps_texture_1k.png 
     71        $(ROAM_TARGET) images/heightmaps/ps_height_1k.png images/textures/ps_texture_1k.png 
    6372 
    64 # Cile objektu 
    65 $(APP) : ./src/SoSimpleROAMTerrainTest.cpp 
    66         @echo "Building test application object..." 
     73geo_run : $(GEO_TARGET) 
     74        @echo "Running test application..." 
     75        $(GEO_TARGET) images/heightmaps/ps_height_1k.png images/textures/ps_texture_1k.png 
     76 
     77# Cil pro profiler 
     78$(PRF) : $(SRC)profiler/PrProfiler.cpp 
     79        @echo "Building profiler object..." 
    6780        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
    6881 
    69 $(TER) : $(SRC)roam/SoSimpleROAMTerrain.cpp 
     82# Cile pro ROAM 
     83$(ROAM_TARGET) : $(ROAM_OBJS) $(PRF) 
     84        @echo "Linking ROAM test application..." 
     85        @$(LD) $^ $(LDFLAGS) -o $(ROAM_TARGET) 
     86 
     87$(ROAM_APP) : ./src/SoSimpleROAMTerrainTest.cpp 
     88        @echo "Building ROAM test application object..." 
     89        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
     90 
     91$(ROAM_TER) : $(SRC)roam/SoSimpleROAMTerrain.cpp 
    7092        @echo "Building ROAM terrain object..." 
    7193        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
    7294 
    73 $(SQE) : $(SRC)roam/SbROAMSplitQueue.cpp 
     95$(ROAM_SQ) : $(SRC)roam/SbROAMSplitQueue.cpp 
    7496        @echo "Building ROAM split queue object..." 
    7597        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
    7698 
    77 $(MQE) : $(SRC)roam/SbROAMMergeQueue.cpp 
     99$(ROAM_MQ) : $(SRC)roam/SbROAMMergeQueue.cpp 
    78100        @echo "Building ROAM merge queue object..." 
    79101        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
    80102 
    81 $(PRI) : $(SRC)roam/SbROAMPrimitives.cpp 
     103$(ROAM_PR) : $(SRC)roam/SbROAMPrimitives.cpp 
    82104        @echo "Building ROAM primitive objects..." 
    83105        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
    84106 
    85 $(PRF) : $(SRC)profiler/PrProfiler.cpp 
    86         @echo "Building profiler object..." 
     107# Cile pro Geo Mip-Mapping 
     108$(GEO_TARGET) : $(GEO_OBJS) $(PRF) 
     109        @echo "Linking Geo Mip-Mapping test application..." 
     110        @$(LD) $^ $(LDFLAGS) -o $(GEO_TARGET) 
     111 
     112$(GEO_APP) : ./src/SoSimpleGeoMipmapTerrainTest.cpp 
     113        @echo "Building Geo Mip-Mapping test Application object..." 
    87114        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
     115 
     116$(GEO_TER) : $(SRC)geomipmapping/SoSimpleGeoMipmapTerrain.cpp 
     117        @echo "Building Geo Mip-Mapping terrain object..." 
     118        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
     119 
     120$(GEO_PR) : $(SRC)geomipmapping/SbGeoMipmapPrimitives.cpp 
     121        @echo "Building Geo Mip-Mapping primitive objects..." 
     122        @$(CXX) -c -o $@ $(CXXFLAGS) $^ 
  • SoTerrain/src/SoSimpleROAMTerrainTest.cpp

    r6 r8  
    2525#include <Inventor/sensors/SoTimerSensor.h> 
    2626 
     27#include <iostream> 
     28#include <cmath> 
    2729#include <simage.h> 
    28 #include <cmath> 
    2930 
    3031#include <roam/SoSimpleROAMTerrain.h> 
     
    271272} 
    272273 
    273 void profilerCallback() 
    274 { 
    275   PR_PRINT_RESULTS("profile.txt"); 
    276 } 
    277  
    278274int main(int argc, char * argv[]) 
    279275{ 
     
    293289  { 
    294290    std::cout << "Chybne zadane parametry programu!" << std::endl; 
    295     std::cout << "Pouziti: roam vyskova_mapa textura" << std::endl; 
     291    std::cout << "Pouziti: SoSimpleROAMTerrainTest vyskova_mapa textura" << std::endl; 
    296292    exit(0); 
    297293  } 
  • SoTerrain/src/geomipmapping/SoSimpleGeoMipmapTerrain.cpp

    r6 r8  
    2626/////////////////////////////////////////////////////////////////////////////// 
    2727 
     28#include <geomipmapping/SoSimpleGeoMipmapTerrain.h> 
     29 
     30/****************************************************************************** 
     31* SoSimpleGeoMipmapTerrain 
     32******************************************************************************* 
     33* public 
     34******************************************************************************/ 
     35 
     36SO_NODE_SOURCE(SoSimpleGeoMipmapTerrain) 
     37 
     38void SoSimpleGeoMipmapTerrain::initClass() 
     39{ 
     40  /* Inicializace tridy. */ 
     41  SO_NODE_INIT_CLASS(SoSimpleGeoMipmapTerrain, SoShape, "Shape"); 
     42  SO_ENABLE(SoGLRenderAction, SoCoordinateElement); 
     43  SO_ENABLE(SoGLRenderAction, SoTextureCoordinateElement); 
     44  SO_ENABLE(SoGLRenderAction, SoViewVolumeElement); 
     45} 
     46 
     47SoSimpleGeoMipmapTerrain::SoSimpleGeoMipmapTerrain() 
     48{ 
     49  /* Inicializace tridy. */ 
     50  SO_NODE_CONSTRUCTOR(SoSimpleGeoMipmapTerrain); 
     51 
     52  /* Inicializace poli */ 
     53  SO_NODE_ADD_FIELD(mapSize, (0)); 
     54  SO_NODE_ADD_FIELD(tileSize, (0)); 
     55  SO_NODE_ADD_FIELD(pixelError, (DEFAULT_PIXEL_ERROR)); 
     56  SO_NODE_ADD_FIELD(frustrumCulling, (true)); 
     57  SO_NODE_ADD_FIELD(freeze, (false)); 
     58} 
     59 
     60/****************************************************************************** 
     61* protected 
     62******************************************************************************/ 
     63 
     64void SoSimpleGeoMipmapTerrain::generatePrimitives(SoAction * action) 
     65{ 
     66  static bool first_run = true; 
     67  if (first_run) 
     68  { 
     69    first_run = false; 
     70  } 
     71 
     72  if (!freeze.getValue()) 
     73  { 
     74 
     75  } 
     76 
     77  /* Vykresleni trojuhelniku. */ 
     78  beginShape(action, TRIANGLES); 
     79 
     80  endShape(); 
     81} 
     82 
     83void SoSimpleGeoMipmapTerrain::computeBBox(SoAction * action, SbBox3f & box, 
     84  SbVec3f & center) 
     85{ 
     86  /* Vypocet ohranicujiciho kvadru a jeho stredu. */ 
     87  float size = mapSize.getValue() - 1.0f; // >-< 
     88  center.setValue(size / 2.0f, size / 2.0f, size / 20.0f); 
     89  box.setBounds(0.0f, 0.0f, 0.0f, size, size, size / 10.0f); 
     90} 
     91 
     92/****************************************************************************** 
     93* private 
     94******************************************************************************/ 
     95 
     96SoSimpleGeoMipmapTerrain::~SoSimpleGeoMipmapTerrain() 
     97{ 
     98 
     99} 
     100 
     101inline bool SoSimpleGeoMipmapTerrain::isInViewVolume(SbGeoMipmapTile * tile) 
     102{ 
     103  return false; 
     104} 
     105 
     106inline float SoSimpleGeoMipmapTerrain::computePriority(SbGeoMipmapTile * tile) 
     107{ 
     108  return 0.0f; 
     109} 
  • SoTerrain/src/profiler/PrProfiler.cpp

    r6 r8  
    2727 
    2828#include <profiler/PrProfiler.h> 
     29 
     30#ifdef PROFILE 
    2931 
    3032/* Cas potrebny na zjisteni frekvence procesoru. */ 
     
    194196{ 
    195197  // neni-li alg_id registrovano vraceni prazdneho retezce 
    196   if ((alg_id < 0) && (alg_id >= alg_names.size())) 
     198  if ((alg_id < 0) && (alg_id >= static_cast<int>(alg_names.size()))) 
    197199  { 
    198200    return ""; 
     
    214216const PrResult & PrProfiler::getResult(long index) 
    215217{ 
    216   if (index >= result_buffer.size()) // je-li prekrocena velikost bufferu 
     218  // je-li prekrocena velikost bufferu 
     219  if (index >= static_cast<int>(result_buffer.size())) 
    217220  { 
    218221    return NULL_RESULT; // chybna hodnota 
     
    262265PrTimeStamp PrProfiler::ticks_per_usec = 1; 
    263266PrTimeStamp PrProfiler::start_time_stamp = 0; 
     267 
     268#endif