| 
                Last change
                  on this file since 3699 was
                  3680,
                  checked in by bensch, 21 years ago
           | 
        
        
          | 
               
orxonox/branches/shadows: merged shadow into this branche, that was falsely put into branches/dave. (also cleared a little error in m_inverse). 
 
           | 
        
        | 
            File size:
            1.4 KB
           | 
      
      
        
  | Rev | Line |   | 
|---|
| [3674] | 1 | /*! | 
|---|
 | 2 |     \file shadow.h | 
|---|
 | 3 |     \brief Definition of the Shadow | 
|---|
 | 4 |      | 
|---|
 | 5 |     Shadow should in a first step only be implemented for the players character | 
|---|
 | 6 |     to be casted on the terrain. This version will only handle the players shjadow! | 
|---|
 | 7 |     Further versions will propably be able to take parameters like player or non | 
|---|
 | 8 |     player character and the final object to cast the shadow on to....So it will then | 
|---|
 | 9 |     be possible(maybe) for an object to cast its shadow onto another object(but I think  | 
|---|
 | 10 |     that will be too much performance eating:) | 
|---|
 | 11 |      | 
|---|
 | 12 |     The basic principle to implement the shadow is to create a texture containing  | 
|---|
 | 13 |     a picture of the shadow. This texture then will be mixed onto the normal ground | 
|---|
 | 14 |     texture to give the impression of a shadow correctly casted on the ground. | 
|---|
 | 15 | */ | 
|---|
 | 16 |  | 
|---|
 | 17 | #ifndef _SHADOW_H | 
|---|
 | 18 | #define _SHADOW_H | 
|---|
 | 19 |  | 
|---|
 | 20 | #include "importer/material.h" | 
|---|
| [3679] | 21 | #include "importer/model.h" | 
|---|
| [3674] | 22 | #include "p_node.h" | 
|---|
 | 23 | #include "world_entity.h" | 
|---|
 | 24 |  | 
|---|
 | 25 | //! A Class to handle the Shadow | 
|---|
 | 26 | class Shadow: public PNode | 
|---|
 | 27 | { | 
|---|
 | 28 |     private: | 
|---|
| [3679] | 29 |         int player_id,ground_id; //These are for the glLists! | 
|---|
 | 30 |         int shadow_id;  //this is for the empty shadow texture | 
|---|
 | 31 |         int lightPos[3]; | 
|---|
 | 32 |          | 
|---|
 | 33 |         unsigned char *image; | 
|---|
 | 34 |         Model* player; | 
|---|
 | 35 |          | 
|---|
| [3674] | 36 |         void blur(unsigned char *in,int size); | 
|---|
| [3679] | 37 |         void createShadow(); | 
|---|
 | 38 |         void m_inverse(const float *m,float *out); | 
|---|
 | 39 |          | 
|---|
 | 40 |      | 
|---|
| [3674] | 41 |     public: | 
|---|
| [3679] | 42 |         Shadow(Model* player,float* groundVertexes); | 
|---|
| [3674] | 43 |         ~Shadow(); | 
|---|
| [3679] | 44 |         void init(); | 
|---|
 | 45 |         void draw(); | 
|---|
| [3674] | 46 |  | 
|---|
 | 47 |  | 
|---|
 | 48 |  | 
|---|
 | 49 |  | 
|---|
 | 50 | }; | 
|---|
 | 51 |  | 
|---|
 | 52 | #endif | 
|---|
 | 53 |      | 
|---|
 | 54 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.