[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" |
---|
[3706] | 21 | #include "importer/objModel.h" |
---|
[3674] | 22 | #include "p_node.h" |
---|
| 23 | #include "world_entity.h" |
---|
[3706] | 24 | #include "player.h" |
---|
[3728] | 25 | #include "vector.h" |
---|
[3674] | 26 | |
---|
| 27 | //! A Class to handle the Shadow |
---|
| 28 | class Shadow: public PNode |
---|
| 29 | { |
---|
| 30 | private: |
---|
[3679] | 31 | int player_id,ground_id; //These are for the glLists! |
---|
| 32 | int shadow_id; //this is for the empty shadow texture |
---|
[3706] | 33 | float lightPos[3]; |
---|
| 34 | float playerPos[3]; |
---|
[3839] | 35 | Material* mat; |
---|
[3679] | 36 | |
---|
| 37 | unsigned char *image; |
---|
[3706] | 38 | OBJModel* player; |
---|
[3728] | 39 | Vector normal_vectors[100][80]; |
---|
| 40 | Vector vertexes[4][100][80]; |
---|
[3706] | 41 | //playerangle used to obtain information about the angle of the player |
---|
| 42 | Player* playerangle; |
---|
[3679] | 43 | |
---|
[3674] | 44 | void blur(unsigned char *in,int size); |
---|
[3737] | 45 | //void createShadow(); |
---|
[3679] | 46 | void m_inverse(const float *m,float *out); |
---|
| 47 | |
---|
[3728] | 48 | |
---|
[3679] | 49 | |
---|
[3674] | 50 | public: |
---|
[3728] | 51 | Shadow(OBJModel* player,Player* playerangle); |
---|
[3674] | 52 | ~Shadow(); |
---|
[4170] | 53 | void init(GLuint ground_id,Material* boden); |
---|
[3737] | 54 | void createShadow(); |
---|
[3679] | 55 | void draw(); |
---|
[3706] | 56 | void updatePosition(float x,float y,float z); |
---|
[3674] | 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | |
---|