Changeset 73

Show
Ignore:
Timestamp:
4.11.2009 09:26:24 (3 weeks ago)
Author:
blackhex
Message:
  • Class hierarchy for image, HTTP and TMS based tile caches and for image loading library wrappers introduced.
Location:
SoTerrain
Files:
12 added
11 modified
2 moved

Legend:

Unmodified
Added
Removed
  • SoTerrain/Makefile.am

    r62 r73  
    99                         src/general/libSoTerrainGeneral.la \ 
    1010                         src/geomipmapping/libSoTerrainGeoMipMapping.la \ 
     11                         src/image/libSoTerrainImage.la \ 
    1112                         src/chunkedlod/libSoTerrainChunkedLoD.la \ 
    1213                         src/roam/libSoTerrainROAM.la 
     
    2526          include/geomipmapping \ 
    2627          include/gui \ 
     28          include/image \ 
    2729          include/chunkedlod \ 
    2830          include/profiler \ 
     
    3335          src/geomipmapping \ 
    3436          src/gui \ 
     37          src/image \ 
    3538          src/chunkedlod \ 
    3639          src/profiler \ 
     
    7578endif 
    7679 
    77 doc : 
     80doc : Doxyfile 
    7881        doxygen Doxyfile 
    7982        touch Doxyfile 
  • SoTerrain/README

    r43 r73  
     1DEPENDENCIES: 
    12 
     3automake 
     4autoconf 
     5autoconf-archive 
     6Coin 
     7SoQt 
     8Qt 
     9 
     10OPTIONAL DEPENDENCIES: 
     11 
     12simage 
     13 
  • SoTerrain/configure.ac

    r62 r73  
    6767AC_SUBST([SIMAGE_PATH]) 
    6868 
     69# Check for CURL. 
     70AX_LIB_CURL([7.15.0], 
     71  [ac_have_curl=yes], 
     72  [ac_have_curl=no; AC_MSG_ERROR([Your system lacks of libcurl >= 7.15.0])]) 
     73CXXFLAGS="$CXXFLAGS $CURL_CFLAGS" 
     74LDFLAGS="$LDFLAGS $CURL_LIBS" 
     75 
    6976# Check for soqt-config. 
    7077AC_CHECK_FILE([$SOQT_PATH/bin/soqt-config], 
    71   [], 
    72   [AC_MSG_FAILURE([soqt-config not found. Try to specify correct path to SoQt libary using --with-soqt=<soqt_path> option.])]) 
     78  [ac_have_soqt=yes], 
     79  [ac_have_simage=no; AC_MSG_FAILURE([soqt-config not found. Try to specify correct path to SoQt libary using --with-soqt=<soqt_path> option.])]) 
     80CXXFLAGS="$CXXFLAGS `$SOQT_PATH/bin/soqt-config --cppflags` -I`pwd`/include/ -Wall -Wno-long-long -ansi" 
     81LDFLAGS="$LDFLAGS `$SOQT_PATH/bin/soqt-config --ldflags` `$SOQT_PATH/bin/soqt-config --libs`" 
    7382 
    7483# Check for simage-config. 
     
    7685  [ac_have_simage=yes], 
    7786  [ac_have_simage=no; AC_MSG_WARN([simage-config not found. Try to specify correct path to simage libary using --with-simage=<simage_path> option.])]) 
    78  
    79 # Set building variables. 
    80 CXXFLAGS="`$SOQT_PATH/bin/soqt-config --cppflags` -I`pwd`/include/ -Wall -Wno-long-long -ansi" 
    81 LDFLAGS="`$SOQT_PATH/bin/soqt-config --ldflags` `$SOQT_PATH/bin/soqt-config --libs`" 
    82  
    8387if test x"$ac_have_simage" = "xyes"; 
    8488then 
     
    133137                 include/geomipmapping/Makefile 
    134138                 include/gui/Makefile 
     139                 include/image/Makefile 
    135140                 include/chunkedlod/Makefile 
    136141                 include/profiler/Makefile 
     
    141146                 src/geomipmapping/Makefile 
    142147                 src/gui/Makefile 
     148                 src/image/Makefile 
    143149                 src/chunkedlod/Makefile 
    144150                 src/profiler/Makefile 
  • SoTerrain/include/data/Makefile.am

    r59 r73  
    22 
    33libSoTerrain_la_HEADERS = SbTile.h \ 
     4                          SbImageTile.h \ 
    45                          SoTileCache.h \ 
    56                          SoTileCacheElement.h \ 
    6                           SbTexture2Tile.h \ 
    7                           SoTexture2TileCache.h 
     7                          SoTexture2TileCache.h \ 
     8                          SoImageTileCache.h \ 
     9                          SoHTTPTileCache.h \ 
     10                          SoTMSTileCache.h 
  • SoTerrain/include/data/SbImageTile.h

    r72 r73  
    1 #ifndef SB_TEXTURE2_TILE 
    2 #define SB_TEXTURE2_TILE 
     1#ifndef SB_IMAGE_TILE 
     2#define SB_IMAGE_TILE 
    33 
    44/////////////////////////////////////////////////////////////////////////////// 
    55//  SoTerrain 
    66/////////////////////////////////////////////////////////////////////////////// 
    7 /// \copybrief SbTexture2Tile 
     7/// \copybrief SbImageTile 
    88/// \file 
    99/// \author Radek Barton (blackhex@post.cz) 
    1010/// \date <br>Created: 2009/06/25<br>Modified: 2009/06/25 
    1111/// 
    12 /// \copydetails SbTexture2Tile 
     12/// \copydetails SbImageTile 
    1313////////////////////////////////////////////////////////////////////////////// 
    1414// Copyright (C) 2009 Radek Barton 
     
    3434#include <SoTerrain/data/SbTile.h> 
    3535 
    36 struct SbTexture2Tile : SbTile 
     36struct SbImageTile : SbTile 
    3737{ 
    3838  public: 
     
    4141    /** 
    4242    */ 
    43     SbTexture2Tile(const int32_t offsetX, const int32_t offsetY, const int32_t 
     43    SbImageTile(const int32_t offsetX, const int32_t offsetY, const int32_t 
    4444      width, const int32_t height, const int32_t lineWidth, const unsigned 
    4545      char * data); 
     
    4747    /** 
    4848    */ 
    49     ~SbTexture2Tile(); 
     49    ~SbImageTile(); 
    5050 
    5151    /* Virtual methods. */ 
     
    8080}; 
    8181 
    82 #endif // SB_TEXTURE2_TILE 
     82#endif // SB_IMAGE_TILE 
  • SoTerrain/include/data/SoTexture2TileCache.h

    r59 r73  
    6868    /** 
    6969    */ 
    70     void doAction(SoAction * action); 
     70    virtual void doAction(SoAction * action); 
    7171 
    7272    /** 
  • SoTerrain/include/data/SoTileCache.h

    r59 r73  
    6161 
    6262    /* Fields. */ 
     63 
    6364    /// TODO 
    6465    SoSFInt32 minResolution; 
  • SoTerrain/m4/soterrain.m4

    r62 r73  
    11# AM_PROG_MOC([MINIMUM-VERSION]) 
    2 # -------------------------------- 
     2# ------------------------------------------------------------------------------ 
    33AC_DEFUN([AM_PROG_MOC], 
    44         [AC_PATH_PROG([MOC], 
     
    1818                             [AC_MSG_RESULT([no]) 
    1919                             AC_MSG_ERROR([MOC version $1 not found.])])]) 
     20 
     21# AX_PATH_GENERIC(LIBRARY,[MINIMUM-VERSION,[SED-EXPR-EXTRACTOR]],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[CONFIG-SCRIPTS],[CFLAGS-ARG],[LIBS-ARG]) 
     22# ------------------------------------------------------------------------------ 
     23AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC]) 
     24AC_DEFUN([AX_PATH_GENERIC],[ 
     25  AC_REQUIRE([AC_PROG_SED]) 
     26 
     27  dnl we're going to need uppercase and lowercase versions of the 
     28  dnl string `LIBRARY' 
     29  pushdef([UP],   translit([$1], [a-z], [A-Z]))dnl 
     30  pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl 
     31 
     32  AC_ARG_WITH(DOWN-prefix,[AS_HELP_STRING([--with-]DOWN[-prefix=PREFIX], [Prefix where $1 is installed (optional)])], 
     33    DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") 
     34  AC_ARG_WITH(DOWN-exec-prefix,[AS_HELP_STRING([--with-]DOWN[-exec-prefix=EPREFIX], [Exec prefix where $1 is installed (optional)])], 
     35    DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") 
     36 
     37  AC_ARG_VAR(UP[]_CONFIG, [config script used for $1]) 
     38  AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1]) 
     39  AC_ARG_VAR(UP[]_LIBS,   [LIBS used for $1]) 
     40 
     41  AS_IF([test x$DOWN[]_config_exec_prefix != x],[ 
     42    DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" 
     43    AS_IF([test x${UP[]_CONFIG+set} != xset],[ 
     44      UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config 
     45    ]) 
     46  ]) 
     47  AS_IF([test x$DOWN[]_config_prefix != x],[ 
     48    DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" 
     49    AS_IF([test x${UP[]_CONFIG+set} != xset],[ 
     50      UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config 
     51    ]) 
     52  ]) 
     53 
     54  AC_PATH_PROGS(UP[]_CONFIG,[$6 DOWN-config],[no]) 
     55  AS_IF([test "$UP[]_CONFIG" == "no"],[ 
     56    : 
     57    $5 
     58  ],[ 
     59    dnl Get the CFLAGS from LIBRARY-config script 
     60    AS_IF([test x"$7" == x],[ 
     61      UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" 
     62    ],[ 
     63      UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args $7`" 
     64    ]) 
     65 
     66    dnl Get the LIBS from LIBRARY-config script 
     67    AS_IF([test x"$8" == x],[ 
     68      UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" 
     69    ],[ 
     70      UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args $8`" 
     71    ]) 
     72 
     73    AS_IF([test x"$2" != x],[ 
     74      dnl Check for provided library version 
     75      AS_IF([test x"$3" != x],[ 
     76        dnl Use provided sed expression 
     77        DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e $3`" 
     78      ],[ 
     79        DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`" 
     80      ]) 
     81 
     82      AC_MSG_CHECKING([for $1 ($DOWN[]_version) >= $2]) 
     83      AX_COMPARE_VERSION($DOWN[]_version,[ge],[$2],[ 
     84        AC_MSG_RESULT([yes]) 
     85 
     86        AC_SUBST(UP[]_CFLAGS) 
     87        AC_SUBST(UP[]_LIBS) 
     88        : 
     89        $4 
     90      ],[ 
     91        AC_MSG_RESULT([no]) 
     92        : 
     93        $5 
     94      ]) 
     95    ],[ 
     96      AC_SUBST(UP[]_CFLAGS) 
     97      AC_SUBST(UP[]_LIBS) 
     98      : 
     99      $4 
     100    ]) 
     101  ]) 
     102 
     103  popdef([UP]) 
     104  popdef([DOWN]) 
     105]) 
     106 
     107# AX_LIB_CURL([VERSION],[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE]) 
     108# ------------------------------------------------------------------------------ 
     109AU_ALIAS([AC_CHECK_CURL], [AX_LIB_CURL]) 
     110AC_DEFUN([AX_LIB_CURL], 
     111  [AX_PATH_GENERIC([curl],[$1],'s/^libcurl\ \+//',[$2],[$3])]) 
  • SoTerrain/src/SoTerrain.cpp

    r61 r73  
    2929#include <SoTerrain/data/SoTileCacheElement.h> 
    3030#include <SoTerrain/data/SoTexture2TileCache.h> 
     31#include <SoTerrain/data/SoHTTPTileCache.h> 
     32#include <SoTerrain/data/SoImageTileCache.h> 
     33#include <SoTerrain/data/SoTMSTileCache.h> 
    3134#include <SoTerrain/geomipmapping/SoGeoMipmapTerrain.h> 
    3235#include <SoTerrain/profiler/SoProfileGroup.h> 
     
    4346  SoTileCacheElement::initClass(); 
    4447  SoTexture2TileCache::initClass(); 
     48  SoImageTileCache::initClass(); 
     49  SoHTTPTileCache::initClass(); 
     50  SoTMSTileCache::initClass(); 
    4551  SoGeoMipmapTerrain::initClass(); 
    4652  SoProfileGroup::initClass(); 
  • SoTerrain/src/data/Makefile.am

    r59 r73  
    22 
    33libSoTerrainData_la_SOURCES = SbTile.cpp \ 
     4                              SbImageTile.cpp \ 
    45                              SoTileCache.cpp \ 
    56                              SoTileCacheElement.cpp \ 
    6                               SbTexture2Tile.cpp \ 
    7                               SoTexture2TileCache.cpp 
     7                              SoTexture2TileCache.cpp \ 
     8                              SoImageTileCache.cpp \ 
     9                              SoHTTPTileCache.cpp \ 
     10                              SoTMSTileCache.cpp 
  • SoTerrain/src/data/SbImageTile.cpp

    r72 r73  
    33/////////////////////////////////////////////////////////////////////////////// 
    44/// \file 
    5 /// \copybrief include/data/SbTexture2Tile.h 
    6 /// \copydetails include/data/SbTexture2Tile.h 
     5/// \copybrief include/data/SbImageTile.h 
     6/// \copydetails include/data/SbImageTile.h 
    77////////////////////////////////////////////////////////////////////////////// 
    88// Copyright (C) 2009 Radek Barton 
     
    3434// SoTerrain includes. 
    3535#include <SoTerrain/debug.h> 
    36 #include <SoTerrain/data/SbTexture2Tile.h> 
     36#include <SoTerrain/data/SbImageTile.h> 
    3737 
    3838/****************************************************************************** 
    39 * SbTexture2Tile - public 
     39* SbImageTile - public 
    4040******************************************************************************/ 
    4141 
    42 SbTexture2Tile::SbTexture2Tile(const int32_t _offsetX, const int32_t _offsetY, 
     42SbImageTile::SbImageTile(const int32_t _offsetX, const int32_t _offsetY, 
    4343  const int32_t width, const int32_t height, const int32_t _lineWidth, const 
    4444  unsigned char * _data): 
     
    4949} 
    5050 
    51 SbTexture2Tile::~SbTexture2Tile() 
     51SbImageTile::~SbImageTile() 
    5252{ 
    5353  // Nothing. 
    5454} 
    5555 
    56 unsigned char SbTexture2Tile::get(const int32_t x, const int32_t y) const 
     56unsigned char SbImageTile::get(const int32_t x, const int32_t y) const 
    5757{ 
    5858  assert(this->data); 
     
    6161} 
    6262 
    63 void SbTexture2Tile::GLRender() 
     63void SbImageTile::GLRender() 
    6464{ 
    6565  assert(this->data); 
     
    8080} 
    8181 
    82 SbBox3f SbTexture2Tile::computeBBox() 
     82SbBox3f SbImageTile::computeBBox() 
    8383{ 
    8484  assert(this->data); 
     
    100100 
    101101/****************************************************************************** 
    102 * SbTexture2Tile - protected 
     102* SbImageTile - protected 
    103103******************************************************************************/ 
    104104 
    105105/****************************************************************************** 
    106 * SbTexture2Tile - private 
     106* SbImageTile - private 
    107107******************************************************************************/ 
  • SoTerrain/src/data/SoTexture2TileCache.cpp

    r72 r73  
    3030// Local includes. 
    3131#include <SoTerrain/SbUtils.h> 
    32 #include <SoTerrain/data/SbTexture2Tile.h> 
     32#include <SoTerrain/data/SbImageTile.h> 
    3333#include <SoTerrain/data/SoTexture2TileCache.h> 
    3434#include <SoTerrain/data/SoTileCacheElement.h> 
     
    6767 
    6868  // Directly return the tile. 
    69   return new SbTexture2Tile(x, y, width, height, this->width, this->data); 
     69  return new SbImageTile(x, y, width, height, this->width, this->data); 
    7070} 
    7171 
  • SoTerrain/src/test/SoTileCacheTest.cpp

    r61 r73  
    4141 
    4242// SoTerrain includes. 
     43#include <SoTerrain/SoTerrain.h> 
    4344#include <SoTerrain/general/SoGeometryTexture2.h> 
    4445#include <SoTerrain/data/SoTexture2TileCache.h> 
     46#include <SoTerrain/data/SoTMSTileCache.h> 
    4547#include <SoTerrain/data/SoTileCacheElement.h> 
    4648 
     
    5355#endif 
    5456 
     57enum cache_type_t 
     58{ 
     59  TEXTURE2, 
     60  TMS 
     61}; 
     62 
     63cache_type_t cache_type = TEXTURE2; 
     64 
    5565/**  */ 
    5666void help() 
    5767{ 
    58   std::cout << "Usage: SoTileCacheTest" << std::endl; 
     68  std::cout << "Usage: SoTileCacheTest [-c (texture2 | tms)]" << std::endl; 
    5969} 
    6070 
     
    6676  // Get program arguments. 
    6777  int command = 0; 
    68   while ((command = getopt(argc, argv, "")) != -1) 
     78  while ((command = getopt(argc, argv, "c:")) != -1) 
    6979  { 
    7080    switch (command) 
    7181    { 
     82      case 'c': 
     83      { 
     84        if (!strcmp(optarg, "tms")) 
     85        { 
     86          cache_type = TMS; 
     87        } 
     88        else 
     89        { 
     90          cache_type = TEXTURE2; 
     91        } 
     92      } 
     93      break; 
    7294      case '?': 
    7395      { 
     
    93115 
    94116  // Initialization of custom Inventor classes. 
    95   SoTileCacheElement::initClass(); 
    96   SoTileCache::initClass(); 
    97   SoGeometryTexture2::initClass(); 
    98   SoTexture2TileCache::initClass(); 
     117  SoTerrain::init(argc, argv); 
    99118  SoDummyTileCacheUser::initClass(); 
    100119 
     
    105124  SoDrawStyle * draw_style = new SoDrawStyle(); 
    106125  SoGeometryTexture2 * heightmap = new SoGeometryTexture2(); 
    107   SoTexture2TileCache * tile_cache = new SoTexture2TileCache(); 
     126  SoTileCache * tile_cache = NULL; 
    108127  SoDummyTileCacheUser * tile_cache_user = new SoDummyTileCacheUser(); 
     128 
     129  switch (cache_type) 
     130  { 
     131    case TEXTURE2: 
     132    { 
     133      tile_cache = new SoTexture2TileCache(); 
     134    } 
     135    break; 
     136    case TMS: 
     137    { 
     138      tile_cache = new SoTMSTileCache(); 
     139    } 
     140    break; 
     141  } 
    109142 
    110143  // Set scene graph nodes properties.