Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3728 in orxonox.OLD


Ignore:
Timestamp:
Apr 5, 2005, 9:53:42 PM (19 years ago)
Author:
dave
Message:

branches/shadows:code erweitert fuer terrain

Location:
orxonox/branches/shadows/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/shadows/src/Makefile.in

    r3698 r3728  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.3 from Makefile.am.
    22# @configure_input@
    33
     
    572572        tags=; \
    573573        here=`pwd`; \
    574         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     574        if (etags --etags-include --version) >/dev/null 2>&1; then \
    575575          include_option=--etags-include; \
    576           empty_fix=.; \
    577576        else \
    578577          include_option=--include; \
    579           empty_fix=; \
    580578        fi; \
    581579        list='$(SUBDIRS)'; for subdir in $$list; do \
    582580          if test "$$subdir" = .; then :; else \
    583             test ! -f $$subdir/TAGS || \
     581            test -f $$subdir/TAGS && \
    584582              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    585583          fi; \
     
    591589          $(AWK) '    { files[$$0] = 1; } \
    592590               END { for (i in files) print i; }'`; \
    593         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    594           test -n "$$unique" || unique=$$empty_fix; \
    595           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    596             $$tags $$unique; \
    597         fi
     591        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     592          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     593             $$tags $$unique
    598594ctags: CTAGS
    599595CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/shadows/src/console/Makefile.in

    r3698 r3728  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.3 from Makefile.am.
    22# @configure_input@
    33
     
    289289          $(AWK) '    { files[$$0] = 1; } \
    290290               END { for (i in files) print i; }'`; \
    291         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    292           test -n "$$unique" || unique=$$empty_fix; \
    293           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    294             $$tags $$unique; \
    295         fi
     291        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     292          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     293             $$tags $$unique
    296294ctags: CTAGS
    297295CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/shadows/src/gui/Makefile.in

    r3698 r3728  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.3 from Makefile.am.
    22# @configure_input@
    33
     
    321321          $(AWK) '    { files[$$0] = 1; } \
    322322               END { for (i in files) print i; }'`; \
    323         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    324           test -n "$$unique" || unique=$$empty_fix; \
    325           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    326             $$tags $$unique; \
    327         fi
     323        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     324          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     325             $$tags $$unique
    328326ctags: CTAGS
    329327CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/shadows/src/importer/Makefile.in

    r3698 r3728  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.3 from Makefile.am.
    22# @configure_input@
    33
     
    306306          $(AWK) '    { files[$$0] = 1; } \
    307307               END { for (i in files) print i; }'`; \
    308         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    309           test -n "$$unique" || unique=$$empty_fix; \
    310           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    311             $$tags $$unique; \
    312         fi
     308        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     309          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     310             $$tags $$unique
    313311ctags: CTAGS
    314312CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/shadows/src/orxonox.cc

    r3706 r3728  
    133133
    134134  int bpp = 16;
    135   int width = 1024;
    136   int height = 768;
     135  int width = 400;
     136  int height = 300;
    137137  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
    138138  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
  • orxonox/branches/shadows/src/shadow.cc

    r3712 r3728  
    2929#include <math.h>
    3030#include "shadow.h"
     31#include "vector.h"
     32
    3133
    3234#define SIZE    128
     
    3941*/
    4042
    41 Shadow::Shadow(OBJModel* player,Player* playerangle,float groundVertexes[])
     43Shadow::Shadow(OBJModel* player,Player* playerangle)
    4244{
    4345    this->player=player;
     
    101103void Shadow::createShadow()
    102104{
    103     glViewport(0,0,2*SIZE,2*SIZE);
    104     glScissor(0,0,2*SIZE,2*SIZE);
     105    glViewport(0,0,SIZE,SIZE);
     106    glScissor(0,0,SIZE,SIZE);
    105107    glEnable(GL_SCISSOR_TEST);
    106108    glBindTexture(GL_TEXTURE_2D,this->shadow_id);
     
    133135   
    134136    glDisable(GL_SCISSOR_TEST);
    135     glViewport(0,0,1024,768); //Achtung: hier Aufloesung von Orxonox einstellen!
     137    glViewport(0,0,400,300); //Achtung: hier Aufloesung von Orxonox einstellen!
    136138     
    137139   
     
    159161
    160162   
     163}
     164
     165/**
     166    brief takes the ground data from the world.cc class and passes it to shadow.cc
     167
     168*/
     169
     170void Shadow::setGround()
     171{
     172    this->ground_id=glGenLists(1);
     173    glNewList(this->ground_id,GL_COMPILE);
     174    glBegin(GL_QUADS);
     175    for(int i=0;i<100;i+=1)
     176        for(int j=0;j<80;j+=1)
     177            {
     178            glNormal3f(normal_vectors[i][j].x,normal_vectors[i][j].y,normal_vectors[i][j].z);
     179            glTexCoord2f(0.0f,0.0f);
     180            glVertex3f(vertexes[0][i][j].x,vertexes[0][i][j].y,vertexes[0][i][j].z);
     181            glNormal3f(normal_vectors[i+1][j].x,normal_vectors[i+1][j].y,normal_vectors[i+1][j].z);
     182            glTexCoord2f(1.0f,0.0f);
     183            glVertex3f(vertexes[1][i][j].x,vertexes[1][i][j].y,vertexes[1][i][j].z);
     184            glNormal3f(normal_vectors[i+1][j+1].x,normal_vectors[i+1][j+1].y,normal_vectors[i+1][j+1].z);
     185            glTexCoord2f(1.0f,1.0f);
     186            glVertex3f(vertexes[2][i][j].x,vertexes[2][i][j].y,vertexes[2][i][j].z);
     187            glNormal3f(normal_vectors[i][j+1].x,normal_vectors[i][j+1].y,normal_vectors[i][j+1].z);
     188            glTexCoord2f(0.0f,1.0f);
     189            glVertex3f(vertexes[3][i][j].x,vertexes[3][i][j].y,vertexes[3][i][j].z);
     190            }
     191    glEnd();
     192    glEndList();   
     193
     194
     195
     196}
     197
     198void Shadow::setNormal(Vector a,int i,int j)
     199{
     200    normal_vectors[i][j]=a;
     201
     202}
     203
     204void Shadow::setVertexNum(Vector a,int i,int j,int num)
     205{
     206    vertexes[num][i][j]=a;
     207
    161208}
    162209/**
     
    209256    createShadow();
    210257   
    211     /*glClearColor(0,0,0,0);
    212     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    213     glMatrixMode(GL_PROJECTION);
    214     glLoadIdentity();
    215     gluPerspective(45,4.0/3.0,.5,100);
    216     glMatrixMode(GL_MODELVIEW);
    217     glLoadIdentity();
    218    
    219     gluLookAt(this->cameraPos[0],this->cameraPos[1],this->cameraPos[2],this->playerPos[0],this->playerPos[1],this->playerPos[2],0,0,1);
    220     */
     258    //glClearColor(0,0,0,0);
     259    //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     260    //glMatrixMode(GL_PROJECTION);
     261    //glLoadIdentity();
     262    //gluPerspective(45,4.0/3.0,.5,100);
     263    //glMatrixMode(GL_MODELVIEW);
     264    //glLoadIdentity();
     265   
     266    //gluLookAt(this->cameraPos[0],this->cameraPos[1],this->cameraPos[2],this->playerPos[0],this->playerPos[1],this->playerPos[2],0,0,1);
     267   
    221268    glEnable(GL_TEXTURE_GEN_S);
    222269    glEnable(GL_TEXTURE_GEN_T);
     
    228275    glLoadIdentity();
    229276    glTranslatef(0.5,0.5,1.0);
     277    glScalef(0.5,0.5,1.0);
    230278    glOrtho(-1,1,-1,1,-1,1);
    231279   
     
    237285    glEnable(GL_BLEND);
    238286    glBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
    239     glCallList(ground_id);
     287    glCallList(this->ground_id);
    240288    glDisable(GL_BLEND);
    241289   
  • orxonox/branches/shadows/src/shadow.h

    r3706 r3728  
    2323#include "world_entity.h"
    2424#include "player.h"
     25#include "vector.h"
    2526
    2627//! A Class to handle the Shadow
     
    3637        unsigned char *image;
    3738        OBJModel* player;
     39        Vector normal_vectors[100][80];
     40        Vector vertexes[4][100][80];
    3841        //playerangle used to obtain information about the angle of the player
    3942        Player* playerangle;
     
    4346        void m_inverse(const float *m,float *out);
    4447       
     48       
    4549   
    4650    public:
    47         Shadow(OBJModel* player,Player* playerangle,float groundVertexes[]);
     51        Shadow(OBJModel* player,Player* playerangle);
    4852        ~Shadow();
    4953        void init();
    5054        void draw();
     55        void setGround();
     56        void setNormal(Vector a,int i,int j);
     57        void setVertexNum(Vector a,int i,int j,int num);
    5158        void updatePosition(float x,float y,float z);
    5259
  • orxonox/branches/shadows/src/world.cc

    r3706 r3728  
    4444  this->debugWorldNr = -1;
    4545  this->entities = new tList<WorldEntity>();
     46 
    4647}
    4748
     
    291292           
    292293            //create shadow
    293             float a[]={1.0,1.0,1.0,4.0};
    294             this->shadow =new Shadow(myPlayer->model,(Player*)myPlayer,a);         
     294           
     295            this->shadow =new Shadow(myPlayer->model,(Player*)myPlayer);           
    295296            shadow->init();                 
    296297           
     
    406407 
    407408 
    408   glBegin(GL_QUADS);
     409 
    409410 
    410411 
     
    419420  float height [sizeX][sizeZ];
    420421  Vector normal_vectors[sizeX][sizeZ];
     422  Vector vertexes[sizeX][sizeZ];
     423 
     424  glBegin(GL_QUADS);
    421425 
    422426 
     
    453457        normal_vectors[i][j]=c1.cross(v3-v5)+c2.cross(v4-v2)+c3.cross(v5-v3)+c4.cross(v2-v4);
    454458        normal_vectors[i][j].normalize();
     459        shadow->setNormal(normal_vectors[i][j],i,j);
    455460      }
    456461
     
    468473        a[2]=1.0;
    469474        glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
     475        shadow->setVertexNum(v1,i,j,0);
     476        shadow->setVertexNum(v2,i,j,1);
     477        shadow->setVertexNum(v3,i,j,2);
     478        shadow->setVertexNum(v4,i,j,3);
     479       
     480       
     481               
    470482       
    471483        glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
     
    473485        //glTexCoord2f((float)i/(float)sizeX,(float)j/(float)sizeZ);
    474486        glVertex3f(v1.x, v1.y, v1.z);
    475        
    476487       
    477488        glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
     
    492503      }
    493504  glEnd();
     505  shadow->setGround();
    494506 
    495507  // Disable Textures Again, for Performance reasons.
Note: See TracChangeset for help on using the changeset viewer.