Pioneer
Loading...
Searching...
No Matches
Thruster.h
Go to the documentation of this file.
1// Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3
4#ifndef _SCENEGRAPH_THRUSTER_H
5#define _SCENEGRAPH_THRUSTER_H
6/*
7 * Spaceship thruster
8 */
9#include "Node.h"
10#include "libs.h"
11
12namespace Graphics {
13 class Renderer;
14 class Material;
15 class MeshObject;
16 class RenderState;
17} // namespace Graphics
18
19namespace SceneGraph {
20
21 class Thruster : public Node {
22 public:
23 Thruster(Graphics::Renderer *, bool linear, const vector3f &pos, const vector3f &dir);
24 Thruster(const Thruster &, NodeCopyCache *cache = 0);
25 Node *Clone(NodeCopyCache *cache = 0) override;
26 virtual void Accept(NodeVisitor &v) override;
27 virtual const char *GetTypeName() const override { return "Thruster"; }
28 virtual void Render(const matrix4x4f &trans, const RenderData *rd) override;
29 virtual void Save(NodeDatabase &) override;
30 static Thruster *Load(NodeDatabase &);
31 void SetColor(const Color c) { currentColor = c; }
32 const vector3f &GetDirection() { return dir; }
33
34 private:
35 // thruster geometry is shared between all instances of Thruster
36 // TODO: load this as a model to allow customization
37 static void CreateThrusterGeometry(Graphics::Renderer *);
38 static RefCountedPtr<Graphics::MeshObject> s_thrustMesh;
40
43 bool linearOnly;
44 vector3f dir;
45 vector3f pos;
46 Color currentColor;
47 };
48
49} // namespace SceneGraph
50
51#endif
Definition Renderer.h:44
Definition RefCounted.h:36
Definition NodeCopyCache.h:14
Definition NodeVisitor.h:26
Definition Node.h:72
Definition Thruster.h:21
virtual void Save(NodeDatabase &) override
Definition Thruster.cpp:120
static Thruster * Load(NodeDatabase &)
Definition Thruster.cpp:128
virtual void Accept(NodeVisitor &v) override
Definition Thruster.cpp:69
Node * Clone(NodeCopyCache *cache=0) override
Definition Thruster.cpp:64
virtual void Render(const matrix4x4f &trans, const RenderData *rd) override
Definition Thruster.cpp:74
void SetColor(const Color c)
Definition Thruster.h:31
const vector3f & GetDirection()
Definition Thruster.h:32
virtual const char * GetTypeName() const override
Definition Thruster.h:27
Definition Background.h:14
Definition CityOnPlanet.h:31
Definition Color.h:66
Definition Node.h:63
Definition Node.h:44