Last change
on this file since 10759 was
10368,
checked in by patrick, 18 years ago
|
merged the branche playability into the trunk
|
File size:
1.4 KB
|
Rev | Line | |
---|
[10081] | 1 | /*! |
---|
| 2 | * @file trail.h |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #ifndef _TRAIL_H_ |
---|
| 6 | #define _TRAIL_H_ |
---|
| 7 | |
---|
| 8 | #include "world_entity.h" |
---|
| 9 | |
---|
| 10 | class Material; |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | class Trail : public WorldEntity |
---|
| 15 | { |
---|
| 16 | ObjectListDeclaration(Trail); |
---|
| 17 | public: |
---|
[10095] | 18 | Trail(float maxLength, int sections, float radius, PNode* parent); |
---|
[10081] | 19 | Trail(const TiXmlElement* root = NULL); |
---|
| 20 | virtual ~Trail(); |
---|
| 21 | |
---|
| 22 | virtual void loadParams(const TiXmlElement* root); |
---|
| 23 | |
---|
| 24 | void setTexture(const std::string& textureFile); |
---|
| 25 | |
---|
| 26 | virtual void tick(float dt); |
---|
| 27 | virtual void draw() const; |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * length of the trail. |
---|
| 31 | */ |
---|
| 32 | inline void setLength(float length) { this->length = length;}; |
---|
| 33 | inline float getLength() { return this->length;}; |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * Amount of sections (parts) of the trail. The more, the rounder it will look |
---|
| 37 | */ |
---|
| 38 | inline void setSections(int sections) { this->sections = sections;}; |
---|
| 39 | inline int getSections() { return this->sections;}; |
---|
| 40 | |
---|
| 41 | /** |
---|
| 42 | * Radius of the trail object |
---|
| 43 | */ |
---|
| 44 | inline void setRadius(float radius) { this->radius = radius;}; |
---|
| 45 | inline float getRadius() { return this->radius;}; |
---|
| 46 | |
---|
| 47 | private: |
---|
| 48 | void init(); |
---|
| 49 | inline Vector catmull(Vector P0, Vector P1, Vector P2, Vector P3, float t) const {return (P1*2 + (P2 - P0)*t + (P0*2 - P1*5- P2*4 - P3)*t*t + (P1*3 -P0 - P2*3 + P3)*t*t*t); }; |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | Material* material; |
---|
| 53 | |
---|
| 54 | float maxLength; |
---|
| 55 | float length; |
---|
| 56 | float radius; |
---|
| 57 | int sections; |
---|
| 58 | |
---|
| 59 | Vector* nodeList; |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | #endif /* _TRAIL_H_ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.