1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#pragma once
#include <QString>
#include "../../../SyntopiaCore/Math/Vector3.h"
#include "../../../SyntopiaCore/Math/Matrix4.h"
namespace StructureSynth {
namespace Model {
namespace Rendering {
/// Abstract base class for implementing a renderer
class Renderer {
public:
Renderer() {};
virtual ~Renderer() {};
/// Flow
virtual void begin() {};
virtual void end() {};
/// This defines the identifier for our renderer.
virtual QString renderClass() { return ""; }
/// The primitives
virtual void drawBox(SyntopiaCore::Math::Vector3f base,
SyntopiaCore::Math::Vector3f dir1,
SyntopiaCore::Math::Vector3f dir2,
SyntopiaCore::Math::Vector3f dir3,
const QString& classID) = 0;
virtual void drawMesh( SyntopiaCore::Math::Vector3f startBase,
SyntopiaCore::Math::Vector3f startDir1,
SyntopiaCore::Math::Vector3f startDir2,
SyntopiaCore::Math::Vector3f endBase,
SyntopiaCore::Math::Vector3f endDir1,
SyntopiaCore::Math::Vector3f endDir2,
const QString& classID) = 0;
virtual void drawGrid(SyntopiaCore::Math::Vector3f base,
SyntopiaCore::Math::Vector3f dir1,
SyntopiaCore::Math::Vector3f dir2,
SyntopiaCore::Math::Vector3f dir3,
const QString& classID) = 0;
virtual void drawLine(SyntopiaCore::Math::Vector3f from,
SyntopiaCore::Math::Vector3f to,
const QString& classID) = 0;
virtual void drawDot(SyntopiaCore::Math::Vector3f pos,
const QString& classID) = 0;
virtual void drawSphere(SyntopiaCore::Math::Vector3f center, float radius,
const QString& classID) = 0;
virtual void drawTriangle(SyntopiaCore::Math::Vector3f p1,
SyntopiaCore::Math::Vector3f p2,
SyntopiaCore::Math::Vector3f p3,
const QString& classID) = 0;
virtual void callGeneric(const QString& /*classID*/) {};
// Color
// RGB in [0;1] intervals.
virtual void setColor(SyntopiaCore::Math::Vector3f rgb) = 0;
virtual void setBackgroundColor(SyntopiaCore::Math::Vector3f rgb) = 0;
virtual void setAlpha(double alpha) = 0;
// Camera settings
virtual void setTranslation(SyntopiaCore::Math::Vector3f /*translation*/) {};
virtual void setScale(double /*scale*/) {};
virtual void setRotation(SyntopiaCore::Math::Matrix4f /*rotation*/) {};
virtual void setPivot(SyntopiaCore::Math::Vector3f /*pivot*/) {};
// Issues a command for a specific renderclass such as 'template' or 'opengl'
virtual void callCommand(const QString& /*renderClass*/, const QString& /*command*/) {};
};
}
}
}
|