Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8087 in orxonox.OLD for branches/bsp_model/src/lib/graphics


Ignore:
Timestamp:
Jun 1, 2006, 5:10:54 PM (18 years ago)
Author:
bensch
Message:

merges some merges

Location:
branches/bsp_model/src/lib/graphics/importer
Files:
1 edited
8 copied

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/Makefile.am

    r6532 r8087  
    1616                           height_map.cc \
    1717                           media_container.cc \
    18                            movie_player.cc
     18                           movie_player.cc \
     19                           \
     20                           bsp_manager.cc \
     21                           bsp_file.cc
     22
     23
    1924
    2025libtc_a_SOURCES  = tc.cc
    2126
    2227
    23 noinst_HEADERS = model.h \
    24                  tc.h \
    25                  vertex_array_model.h \
    26                  grid.h \
    27                  static_model.h \
    28                  objModel.h \
    29                  primitive_model.h \
    30                  md2Model.h \
    31                  material.h \
    32                  texture.h \
    33                  texture_sequence.h \
    34                  height_map.h \
    35                  anorms.h \
    36                  anormtab.h \
    37                  media_container.h \
    38                  movie_player.h
     28noinst_HEADERS = \
     29                model.h \
     30                tc.h \
     31                vertex_array_model.h \
     32                grid.h \
     33                static_model.h \
     34                objModel.h \
     35                primitive_model.h \
     36                md2Model.h \
     37                material.h \
     38                texture.h \
     39                texture_sequence.h \
     40                height_map.h \
     41                anorms.h \
     42                anormtab.h \
     43                media_container.h \
     44                movie_player.h\
     45                \
     46                bsp_manager.h \
     47                bsp_file.h
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r8083 r8087  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
    13    
     13
    1414   Inspired by:
    1515   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
    1616   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
    17    
     17
    1818   Collision detection adapted from:
    1919   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
     
    6060  */
    6161  CDEngine::getInstance()->setBSPModel(this);
    62  
    63  
    64  
    6562}
    6663
     
    7067{
    7168
    72  
     69
    7370  if( root != NULL)
    7471    this->loadParams(root);
    75  
     72
    7673  CDEngine::getInstance()->setBSPModel(this);
    7774} */
     
    117114  this->out1.y += this->collPlane->y*5.0;
    118115  this->out1.z += this->collPlane->z*5.0;
    119  
     116
    120117  this->out2.x += this->collPlane->x*10.0;
    121118  this->out2.y += this->collPlane->y*10.0;
     
    124121  this->drawDebugCube(&this->out1);
    125122  this->drawDebugCube(&this->out2);
    126   */ 
     123  */
    127124  // Draw Debug Terrain
    128125  /*
    129   this->bspFile->Materials[0]->select(); 
     126  this->bspFile->Materials[0]->select();
    130127  for(int i = 0; i <  this->bspFile->numPatches ; i++)
    131         {
    132                 this->bspFile->VertexArrayModels[i]->draw();
    133    
    134         }
     128        {
     129                this->bspFile->VertexArrayModels[i]->draw();
     130
     131        }
    135132  */
    136133
     
    283280  glActiveTextureARB(GL_TEXTURE1_ARB);
    284281  glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap);
    285  
    286  
     282
     283
    287284
    288285}//draw
     
    540537      // don't store plane
    541538      // this->collPlane = &curPlane;
    542      
     539
    543540    } else {   // line is leaving the brush
    544541      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     
    547544      // don't store plane
    548545      //this->collPlane = & curPlane;
    549      
     546
    550547    }
    551548
     
    562559      if (startFraction < 0)
    563560        startFraction = 0;
    564       this->outputFraction = startFraction; 
     561      this->outputFraction = startFraction;
    565562    }
    566563  }
     
    609606      // store plane
    610607      this->collPlane = &curPlane;
    611      
     608
    612609    } else {   // line is leaving the brush
    613610      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     
    616613      // store plane
    617614      this->collPlane = & curPlane;
    618      
     615
    619616    }
    620617
     
    631628      if (startFraction < 0)
    632629        startFraction = 0;
    633       this->outputFraction = startFraction; 
     630      this->outputFraction = startFraction;
    634631    }
    635632  }
     
    831828{
    832829  return;
    833  
     830
    834831  Vector position = worldEntity->getAbsCoor();
    835832
     
    839836  forwardDir.y =2.0*forwardDir.y;
    840837  forwardDir.z =2.0*forwardDir.z;
    841  
     838
    842839  Vector upDir = worldEntity->getAbsDirY();
    843840  Vector dest = position;
     
    847844  Vector out = Vector(-1875.0,-1875.0,-1875.0);
    848845  if(!worldEntity->isA(CL_PLAYABLE)) {
    849    
    850    
    851    
    852  
     846
     847
     848
     849
    853850  }
    854851  else {
     
    882879
    883880    }
    884    
     881
    885882    this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
    886883    if(this->outputFraction == 1.0f) out = dest;
     
    891888    out.y = position.y + (dest.y -position.y) * this->outputFraction;
    892889    out.z = position.z + (dest.z -position.z) * this->outputFraction;
    893    
     890
    894891    //Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
    895892    //this->out = out;
     
    898895    //this->drawDebugCube(&out1);
    899896    //this->drawDebugCube(&out2);
    900    
     897
    901898    //this->drawDebugCube(&out3);
    902  
    903     }
    904    
     899
     900    }
     901
    905902    // Return the normal here: Normal's stored in this->collPlane;
    906903    if(collision) worldEntity->collidesWithGround(out,out1,out2);
    907  
     904
    908905  }
    909906
     
    947944
    948945    /*
    949         for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
    950         {
    951                 brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
    952                 if(curBrush.n_brushsides < 0) return;
    953                 for(int j = 0; j < curBrush.n_brushsides; j++)
    954                 {
    955                 float dist = -0.1;
    956                 brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
    957                 plane&      testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];
    958                 dist = testPlane.x * this->cam.x +  testPlane.y * this->cam.y  +  testPlane.z * this->cam.z   -testPlane.d ;
    959                
    960                 if(dist < -0.01f) dist = -1.0f *dist;
    961                 if(dist < 1.0f){
    962                                 this->drawDebugCube(&this->cam);
    963                                 return;
    964                               }
    965                 }
    966                        
    967         } */
     946        for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
     947        {
     948                brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
     949                if(curBrush.n_brushsides < 0) return;
     950                for(int j = 0; j < curBrush.n_brushsides; j++)
     951                {
     952                float dist = -0.1;
     953                brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
     954                plane&      testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];
     955                dist = testPlane.x * this->cam.x +  testPlane.y * this->cam.y  +  testPlane.z * this->cam.z   -testPlane.d ;
     956
     957                if(dist < -0.01f) dist = -1.0f *dist;
     958                if(dist < 1.0f){
     959                                this->drawDebugCube(&this->cam);
     960                                return;
     961                              }
     962                }
     963
     964        } */
    968965
    969966  }
Note: See TracChangeset for help on using the changeset viewer.