1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 /* QuadWallSceneNode: 14 * Encapsulates information for rendering a quadrilateral wall. 15 */ 16 17 #ifndef BZF_QUAD_WALL_SCENE_NODE_H 18 #define BZF_QUAD_WALL_SCENE_NODE_H 19 20 // Inherits from 21 #include "WallSceneNode.h" 22 23 class QuadWallSceneNode : public WallSceneNode 24 { 25 public: 26 QuadWallSceneNode(const GLfloat base[3], 27 const GLfloat sEdge[3], 28 const GLfloat tEdge[3], 29 float uRepeats = 1.0, 30 float vRepeats = 1.0, 31 bool makeLODs = true, 32 bool fixedUVs = false); 33 QuadWallSceneNode(const GLfloat base[3], 34 const GLfloat sEdge[3], 35 const GLfloat tEdge[3], 36 float uOffset, 37 float vOffset, 38 float uRepeats, 39 float vRepeats, 40 bool makeLODs); 41 ~QuadWallSceneNode(); 42 43 int split(const float*, SceneNode*&, SceneNode*&) const; 44 45 void addRenderNodes(SceneRenderer&); 46 void addShadowNodes(SceneRenderer&); 47 void renderRadar(); 48 49 50 bool inAxisBox (const Extents& exts) const; 51 52 int getVertexCount () const; 53 const GLfloat* getVertex (int vertex) const; 54 55 virtual void getRenderNodes(std::vector<RenderSet>& rnodes); 56 57 private: 58 void init(const GLfloat base[3], 59 const GLfloat uEdge[3], 60 const GLfloat vEdge[3], 61 float uOffset, 62 float vOffset, 63 float uRepeats, 64 float vRepeats, 65 bool makeLODs, bool fixedUVs); 66 67 protected: 68 class Geometry : public RenderNode 69 { 70 public: 71 Geometry(QuadWallSceneNode*, 72 int uCount, int vCount, 73 const GLfloat base[3], 74 const GLfloat uEdge[3], 75 const GLfloat vEdge[3], 76 const GLfloat* normal, 77 float uOffset, float vOffset, 78 float uRepeats, float vRepeats, 79 bool fixedUVs); 80 ~Geometry(); setStyle(int _style)81 void setStyle(int _style) 82 { 83 style = _style; 84 } 85 void render(); 86 void renderShadow(); 87 const GLfloat* getVertex(int i) const; getPosition()88 const GLfloat* getPosition() const 89 { 90 return wall->getSphere(); 91 } 92 private: 93 void drawV() const; 94 void drawVT() const; 95 private: 96 WallSceneNode* wall; 97 int style; 98 int ds, dt; 99 int dsq, dsr; 100 const GLfloat* normal; 101 public: 102 GLfloat3Array vertex; 103 GLfloat2Array uv; 104 int triangles; 105 }; 106 107 private: 108 Geometry** nodes; 109 Geometry* shadowNode; 110 }; 111 112 #endif // BZF_QUAD_WALL_SCENE_NODE_H 113 114 // Local Variables: *** 115 // mode: C++ *** 116 // tab-width: 4 *** 117 // c-basic-offset: 4 *** 118 // indent-tabs-mode: nil *** 119 // End: *** 120 // ex: shiftwidth=4 tabstop=4 121