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 /* LaserSceneNode: 14 * Encapsulates information for rendering a laser beam. 15 */ 16 17 #ifndef BZF_LASER_SCENE_NODE_H 18 #define BZF_LASER_SCENE_NODE_H 19 20 #include "common.h" 21 #include "SceneNode.h" 22 23 class LaserSceneNode : public SceneNode 24 { 25 public: 26 LaserSceneNode(const GLfloat pos[3], 27 const GLfloat forward[3]); 28 ~LaserSceneNode(); 29 30 void setTexture(const int); 31 32 bool cull(const ViewFrustum&) const; 33 34 void notifyStyleChange(); 35 void addRenderNodes(SceneRenderer&); 36 37 void setColor ( float r, float g, float b ); 38 void setCenterColor ( float r, float g, float b ); setFirst(void)39 void setFirst ( void ) 40 { 41 first = true; 42 } 43 44 protected: 45 class LaserRenderNode : public RenderNode 46 { 47 public: 48 LaserRenderNode(const LaserSceneNode*); 49 ~LaserRenderNode(); 50 void render(); getPosition()51 const GLfloat* getPosition() const 52 { 53 return sceneNode->getSphere(); 54 } 55 private: 56 void renderFlatLaser(); 57 void renderGeoLaser(); 58 const LaserSceneNode* sceneNode; 59 static GLfloat geom[6][2]; 60 }; 61 fvec4 color; 62 fvec4 centerColor; 63 bool first; 64 friend class LaserRenderNode; 65 66 private: 67 GLfloat azimuth, elevation; 68 GLfloat length; 69 bool texturing; 70 OpenGLGState gstate; 71 LaserRenderNode renderNode; 72 }; 73 74 #endif // BZF_LASER_SCENE_NODE_H 75 76 // Local Variables: *** 77 // mode: C++ *** 78 // tab-width: 4 *** 79 // c-basic-offset: 4 *** 80 // indent-tabs-mode: nil *** 81 // End: *** 82 // ex: shiftwidth=4 tabstop=4 83