/
irender.h
782 lines (657 loc) · 23.9 KB
/
irender.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
#pragma once
#include "imodule.h"
#include "ivolumetest.h"
#include "iwindingrenderer.h"
#include "igeometryrenderer.h"
#include "isurfacerenderer.h"
#include <functional>
#include <vector>
#include "math/Vector3.h"
#include "math/Vector4.h"
#include "render/Colour4.h"
#include "math/AABB.h"
#include "render/ArbitraryMeshVertex.h"
#include "ishaderlayer.h"
#include <sigc++/signal.h>
/**
* \file
* Interfaces for the back-end renderer.
*/
/**
* \name Global render flags
*
* These flags control which capabilities of the renderer are used throughout
* the render process. They have a four stage lifecycle:
*
* 1. The flags are initially SET in the Shader implementation, describing the
* features that the particular Shader would like to use for rendering its
* renderables. For example, a shader pass performing a blend will set
* RENDER_BLEND as one of its flags.
*
* 2. The flags are MASKED by another set of flags provided to a
* RenderableCollector before it traverses the scene graph, in order to control
* which shader-specified flags can actually be used for that render pass. For
* example, the XYRenderer renders in wireframe mode only, so it does not enable
* RENDER_FILL in its mask, while the CamRenderer does.
*
* 3. The flags may be used to set or change OpenGL state in the shader pass
* implementation. For example, if RENDER_BLEND is set, then glEnable(GL_BLEND)
* will be called before the associated shader's renderables are rendered. Some
* flags map directly to glEnable parameters, while others (such as
* RENDER_PROGRAM) specify more complex changes. Some flags do not enable any GL
* features at all.
*
* 4. The flags are passed as a parameter to the OpenGLRenderable::render()
* method, allowing individual objects to modify their behaviour accordingly.
* For example, objects may decide whether or not to submit colour information
* to OpenGL based on the value of the RENDER_VERTEX_COLOUR flag.
*/
///@{
const unsigned RENDER_DEFAULT = 0;
const unsigned RENDER_LINESTIPPLE = 1 << 0; // glEnable(GL_LINE_STIPPLE)
const unsigned RENDER_POLYGONSTIPPLE = 1 << 2; // glEnable(GL_POLYGON_STIPPLE)
const unsigned RENDER_ALPHATEST = 1 << 4; // glEnable(GL_ALPHA_TEST)
const unsigned RENDER_DEPTHTEST = 1 << 5; // glEnable(GL_DEPTH_TEST)
const unsigned RENDER_DEPTHWRITE = 1 << 6; // glDepthMask(GL_TRUE)
/// Colour buffer writing disabled with glColorMask
const unsigned RENDER_MASKCOLOUR = 1 << 7;
const unsigned RENDER_CULLFACE = 1 << 8; // glglEnable(GL_CULL_FACE)
const unsigned RENDER_SCALED = 1 << 9; // glEnable(GL_NORMALIZE)
const unsigned RENDER_SMOOTH = 1 << 10; // glShadeModel
const unsigned RENDER_LIGHTING = 1 << 11; // glEnable(GL_LIGHTING)
const unsigned RENDER_BLEND = 1 << 12; // glEnable(GL_BLEND)
const unsigned RENDER_OFFSETLINE = 1 << 13; // glEnable(GL_POLYGON_OFFSET_LINE)
/// Objects will be rendered as filled polygons (not wireframe).
const unsigned RENDER_FILL = 1 << 14;
/**
* If enabled, mesh objects (geometry that does not consist only of GL_POINTS)
* should submit vertex colour information. If disabled, mesh objects must not
* change glColor during rendering.
*
* Does not affect GL state.
*/
const unsigned RENDER_VERTEX_COLOUR = 1 << 15;
/**
* If enabled, point geometry may submit colours for each point. If disabled,
* point geometry must not change colour during rendering.
*
* Does not affect GL state.
*/
const unsigned RENDER_POINT_COLOUR = 1 << 16;
/// GL_TEXTURE_2D will be enabled during rendering.
const unsigned RENDER_TEXTURE_2D = 1 << 17;
/**
* Cube map rendering (in camera space) is enabled. The renderer will enable
* GL_TEXTURE_CUBE_MAP, and set up the texture matrix such that the viewer
* location is the origin. Objects should submit their vertex coordinates as
* texture coordinates, which will result in the correct cube map alignment.
*/
const unsigned RENDER_TEXTURE_CUBEMAP = 1 << 18;
/**
* Normal map information will be used during rendering. If enabled, objects
* should submit normal/tangent/bitangent vertex attributes to enable normal
* mapping. Also used by shader passes to signal that they care about lighting
* (and need to be provided with a list of incident lights along with
* renderable objects).
*/
const unsigned RENDER_BUMP = 1 << 19;
/// A vertex and fragment shader program will be used during rendering.
const unsigned RENDER_PROGRAM = 1 << 20;
const unsigned RENDER_OVERRIDE = 1 << 21;
typedef unsigned RenderStateFlags;
///@}
class AABB;
class Matrix4;
template<typename Element> class BasicVector3;
typedef BasicVector3<double> Vector3;
class Shader;
typedef std::shared_ptr<Shader> ShaderPtr;
struct RenderableGeometry;
/**
* A RenderEntity represents a map entity as seen by the renderer.
* It provides up to 12 numbered parameters to the renderer:
* parm0, parm1 ... parm11.
*
* A few of the entity parms are hardwired to things like render colour
* as defined through the entity's _color keyvalue, some are set through
* scripting, spawmargs or gameplay code.
*/
class IRenderEntity
{
public:
/**
* Get the value of this entity's shader parm with the given index.
*/
virtual float getShaderParm(int parmNum) const = 0;
/**
* Entities can specify directions, which are used for particle emission for instance.
*/
virtual const Vector3& getDirection() const = 0;
/**
* Returns the wireframe shader for this entity - child primitives need this for rendering.
*/
virtual const ShaderPtr& getWireShader() const = 0;
/**
* Returns the shader that is used to render coloured primitives like lines and points,
* using the colour of the entity as defined by its entityDef, light colour, etc.
* This shader will be applicable to both camera and ortho views, it can be used for
* visualisations such as target lines and light boxes.
*/
virtual const ShaderPtr& getColourShader() const = 0;
/**
* Returns the colour of this entity, that is used to display its
* wireframe representation.
*/
virtual Vector4 getEntityColour() const = 0;
/**
* Associates the given surface with this entity.
* It will be processed during the following lighting mode rendering passes.
*/
virtual void addSurface(const render::IRenderableSurface::Ptr& surface) = 0;
/**
* Removes the surface from this entity.
*/
virtual void removeSurface(const render::IRenderableSurface::Ptr& surface) = 0;
};
typedef std::shared_ptr<IRenderEntity> IRenderEntityPtr;
typedef std::weak_ptr<IRenderEntity> IRenderEntityWeakPtr;
/**
* \brief Interface for a light source in the renderer.
*/
class RendererLight
{
public:
virtual ~RendererLight() {}
/**
* \brief Return the render entity associated with this light
*
* The IRenderEntity is used to evaluate possible shader expressions in the
* shader returned by getShader(). The light object itself may be its own
* render entity (so getLightEntity() can just return *this).
*/
virtual const IRenderEntity& getLightEntity() const = 0;
/// Return the shader for this light
virtual const ShaderPtr& getShader() const = 0;
/**
* \brief Return the world-space to light-texture-space transformation matrix.
*
* The light texture space is a box, with coordinates [0..1] on each
* dimension, representing the texture (UV) coordinates of the light falloff
* textures that will be applied to rendered fragments within the light
* volume.
*
* The matrix returned by this method transforms coordinates in world space
* into coordinates in light-texture space.
*/
virtual Matrix4 getLightTextureTransformation() const = 0;
/**
* \brief Return the AABB of the illuminated volume.
*
* This AABB represents the boundaries of the volume which are illuminated
* by this light. Anything outside of this volume does not need to be
* considered for shading by this light.
*
* Note that for omni lights, dragging the light center point outside of
* the light volume does not expand the lightAABB() value, because the
* light center only affects the direction of the light rays, not the size
* of the illuminated volume.
*/
virtual AABB lightAABB() const = 0;
/**
* \brief Return the light origin in world space.
*
* The light origin is the point from which the light rays are considered to
* be projected, i.e. the direction from which bump maps will be illuminated
* and shadows (if they existed) would be cast.
*
* For an omindirectional light, this origin is determined from the
* "light_center" keyvalue in combination with the bounding box itself,
* whereas for a projected light it is always equal to the tip of the
* pyramid (the same as worldOrigin()).
*/
virtual Vector3 getLightOrigin() const = 0;
};
typedef std::shared_ptr<RendererLight> RendererLightPtr;
/// Debug stream insertion for RendererLight
inline std::ostream& operator<< (std::ostream& os, const RendererLight& l)
{
return os << "RendererLight(origin=" << math::pp(l.getLightOrigin())
<< ", lightAABB=" << l.lightAABB() << ")";
}
/**
* \brief Interface for an object which can test its intersection with a
* RendererLight.
*
* Objects which implement this interface define a intersectsLight() function
* which determines whether the given light intersects the object.
*/
class LitObject
{
public:
virtual ~LitObject() {}
/// Test if the given light intersects the LitObject
virtual bool intersectsLight(const RendererLight& light) const = 0;
};
typedef std::shared_ptr<LitObject> LitObjectPtr;
class Renderable;
typedef std::function<void(Renderable&)> RenderableCallback;
typedef std::function<void(const RendererLight&)> RendererLightCallback;
/**
* \brief
* Simple container of light sources
*
* This is a storage class used to represent all light sources which fall upon
* a particular object. It is passed to the RenderSystem at render time to
* provide the list of lights which intersect the Renderable being submitted.
*/
class LightSources
{
public:
/// Invoke a callback on all contained lights.
virtual void forEachLight(const RendererLightCallback& callback) const = 0;
};
/// Debug stream insertion for LightSources
inline std::ostream& operator<< (std::ostream& s, const LightSources& ls)
{
s << "LightSources(";
// Insert comma-separated list of RendererLights
bool addComma = false;
ls.forEachLight(
[&](const RendererLight& l)
{
if (addComma)
s << ", ";
s << l;
addComma = true;
}
);
return s << ")";
}
/// Debug stream insertion for possibly null LightSources pointer
inline std::ostream& operator<< (std::ostream& s, const LightSources* ls)
{
if (ls)
return s << *ls;
else
return s << "[no lightsources]";
}
const int c_attr_TexCoord0 = 1;
const int c_attr_Tangent = 3;
const int c_attr_Binormal = 4;
/**
* \brief
* Data object passed to the backend OpenGLRenderable::render() method
* containing information about the render pass which may be of use to
* renderable objects, including the render flags and various
* matrices/coordinates.
*/
class RenderInfo
{
// Render flags
RenderStateFlags _flags;
// Viewer location in 3D space
Vector3 _viewerLocation;
// Cube map mode
IShaderLayer::CubeMapMode _cubeMapMode;
public:
/// Default constructor
RenderInfo(RenderStateFlags flags = RENDER_DEFAULT,
const Vector3& viewer = Vector3(0, 0, 0),
IShaderLayer::CubeMapMode cubeMode = IShaderLayer::CUBE_MAP_NONE)
: _flags(flags),
_viewerLocation(viewer),
_cubeMapMode(cubeMode)
{ }
/// Check if a flag is set
bool checkFlag(unsigned flag) const
{
return (_flags & flag) != 0;
}
/// Get the entire flag bitfield.
RenderStateFlags getFlags() const
{
return _flags;
}
/// Get the viewer location.
const Vector3& getViewerLocation() const
{
return _viewerLocation;
}
/// Get the cube map mode.
IShaderLayer::CubeMapMode getCubeMapMode() const
{
return _cubeMapMode;
}
};
/**
* \brief
* Interface for objects which can render themselves in OpenGL.
*
* This interface is used by the render backend, after renderable objects have
* first been submitted using the Renderable interface. The backend render()
* function should contain the OpenGL calls necessary to submit vertex, normal
* and texture-coordinate data.
*
* No GL state changes should occur in render(), other than those specifically
* allowed by the render flags.
*/
class OpenGLRenderable
{
public:
virtual ~OpenGLRenderable() {}
/**
* \brief
* Submit OpenGL render calls.
*/
virtual void render(const RenderInfo& info) const = 0;
};
class Matrix4;
class Texture;
#include "math/Vector3.h"
class Material;
typedef std::shared_ptr<Material> MaterialPtr;
/**
* A Shader represents a single material which can be rendered in OpenGL, which
* may correspond to an actual material (Material), a raw colour or a special
* GL shader.
*
* Importantly, a Shader also maintains its own list of OpenGLRenderable objects
* which use it -- the actual rendering is performed by traversing a list of
* Shaders and rendering the geometry attached to each one.
*/
class Shader :
public render::IWindingRenderer,
public render::IGeometryRenderer,
public render::ISurfaceRenderer
{
public:
// Observer interface to get notified on (un-)realisation
class Observer
{
public:
virtual void onShaderRealised() = 0;
virtual void onShaderUnrealised() = 0;
};
virtual ~Shader() {}
/// Return the name used to construct this shader
virtual std::string getName() const = 0;
/**
* \brief
* Attach a renderable object to this Shader, which will be rendered using
* this Shader when the render backend is activated.
*
* \param renderable
* The OpenGLRenderable object to add.
*
* \param modelview
* The modelview transform for this object.
*
* \param lights
* Optional LightSources containing all of the lights which illuminate this
* object.
*
* \param entity
* Optional IRenderEntity exposing entity-related render parameters.
*/
virtual void addRenderable(const OpenGLRenderable& renderable,
const Matrix4& modelview,
const LightSources* lights = nullptr,
const IRenderEntity* entity = nullptr) = 0;
/**
* \brief
* Control the visibility of this shader.
*
* A shader that is not visible will perform no rendering and ignore any
* renderables submitted to it with addRenderable().
*/
virtual void setVisible(bool visible) = 0;
/// Query if this shader is visible
virtual bool isVisible() const = 0;
virtual void incrementUsed() = 0;
virtual void decrementUsed() = 0;
// Attach/detach an observer to this shader object.
// In case the shader is already realised when attachObserver() is called,
// the observer's onShaderRealised() method is immediately invoked.
// The analogous holds for detachObserver(): if the shader is realised,
// the observer's onShaderUnrealised() method is invoked before unregistering it.
virtual void attachObserver(Observer& observer) = 0;
virtual void detachObserver(Observer& observer) = 0;
virtual bool isRealised() = 0;
/**
* \brief Retrieve the Material that was used to construct this shader (if
* any).
*
* \return
* An Material subclass with information about the shader definition
*/
virtual const MaterialPtr& getMaterial() const = 0;
virtual unsigned int getFlags() const = 0;
};
/**
* Shared pointer typedef for Shader.
*/
typedef std::shared_ptr<Shader> ShaderPtr;
// Defines a piece of text that should be rendered in the scene
class IRenderableText
{
public:
// The position in world space where the text needs to be rendered
virtual const Vector3& getWorldPosition() = 0;
// The text to be rendered. Returning an empty text will skip this renderable.
virtual const std::string& getText() = 0;
// The colour of the text
virtual const Vector4& getColour() = 0;
};
// An ITextRenderer is able to draw one or more IRenderableText
// instances to the scene
class ITextRenderer
{
public:
using Ptr = std::shared_ptr<ITextRenderer>;
using Slot = std::uint64_t;
static constexpr Slot InvalidSlot = std::numeric_limits<Slot>::max();
// Registers the given text instance for rendering
virtual Slot addText(IRenderableText& text) = 0;
// Removes the text instance in the given Slot
// The slot handle is invalidated by this operation and should be
// discarded by the client, by setting it to InvalidSlot
virtual void removeText(Slot slot) = 0;
};
const char* const MODULE_RENDERSYSTEM("ShaderCache");
// Render view type enumeration, is used to select (or leave out)
// Shader objects during rendering
enum class RenderViewType
{
Camera = 1 << 0,
OrthoView = 1 << 1,
};
enum class BuiltInShaderType
{
// A medium-sized point
Point,
// A bigger version of "Point"
BigPoint,
// Lines connecting the patch control points
PatchLattice,
// Line shader drawing above regular things
WireframeOverlay,
// Fill shader drawing above regular things
FlatshadeOverlay,
// Line shader used for drawing AAS area bounds
AasAreaBounds,
// Shader used for the boxes marking missing models
MissingModel,
// The polygon showing the clip plane intersecting brushes
BrushClipPlane,
// Line shader connecting the leak point trace
PointTraceLines,
// This is the shader drawing a coloured overlay
// over faces/polys. Its colour is configurable,
// and it has depth test activated (camera).
ColouredPolygonOverlay,
// This is the shader drawing a solid line to outline
// a selected item. The first pass has its depth test
// activated using GL_LESS, whereas the second pass
// draws the hidden lines in stippled appearance
// with its depth test using GL_GREATER (camera).
HighlightedPolygonOutline,
// Coloured line stipple overlay of selected items (ortho)
WireframeSelectionOverlay,
// Coloured line stipple overlay of selected grouped items (ortho)
WireframeSelectionOverlayOfGroups,
// Line shader used for drawing the three axes at entity origins
Pivot,
// Coloured merge action highlights (camera)
CameraMergeActionOverlayAdd,
CameraMergeActionOverlayRemove,
CameraMergeActionOverlayChange,
CameraMergeActionOverlayConflict,
// Coloured merge action highlights (ortho)
OrthoMergeActionOverlayAdd,
OrthoMergeActionOverlayRemove,
OrthoMergeActionOverlayChange,
OrthoMergeActionOverlayConflict,
};
// Available types of colour shaders. These areused
// to draw map items in the ortho view, or to render
// connection lines, light volumes in both camera and ortho.
enum class ColourShaderType
{
// Fill shader, non-transparent
CameraSolid,
// Fill shader with transparency
CameraTranslucent,
// Solid lines used for ortho view rendering
OrthoviewSolid,
// Items drawn in both camera and ortho views
CameraAndOrthoview,
};
/**
* \brief
* The main interface for the backend renderer.
*/
class RenderSystem
: public RegisterableModule
{
public:
/**
* \brief
* Capture the given shader, increasing its reference count and
* returning a pointer to the Shader object.
*
* @param name
* The name of the shader to capture.
*
* @returns
* Shader* object corresponding to the given material shader name.
*/
virtual ShaderPtr capture(const std::string& name) = 0;
/**
* Retrieves an ITextRenderer instance with the given font style and size.
* This renderer will accept IRenderableText instances which define
* the actual text, colour and position.
*/
virtual ITextRenderer::Ptr captureTextRenderer(IGLFont::Style style, std::size_t size) = 0;
/**
* Acquire one of DarkRadiant's built-in shaders, used for drawing
* things like connectors, lines, points and overlays.
*/
virtual ShaderPtr capture(BuiltInShaderType type) = 0;
/**
* Capture a colour shader, there are various types available
* for rendering in ortho views, camera or both.
*/
virtual ShaderPtr capture(ColourShaderType type, const Colour4& colour) = 0;
/**
* Register the given entity to be considered during rendering.
*/
virtual void addEntity(const IRenderEntityPtr& renderEntity) = 0;
/**
* Detaches this entity from this rendersystem, it won't be
* affected by any rendering after this call.
*/
virtual void removeEntity(const IRenderEntityPtr& renderEntity) = 0;
/**
* Enumerates all known render entities in this system, invoking
* the functor for each of them.
*/
virtual void foreachEntity(const std::function<void(const IRenderEntityPtr&)>& functor) = 0;
/**
* \brief
* Main render method.
*
* This method traverses all of the OpenGLRenderable objects that have been
* submitted to Shader instances, and invokes their render() method to draw
* their geometry.
*
* \param globalFlagsMask
* The mask of render flags which are permitted during this render pass. Any
* render flag which is 0 in this mask will not be enabled during rendering,
* even if the particular shader requests it.
*
* \param modelview
* The modelview transformation matrix to apply before rendering.
*
* \param projection
* The view projection matrix to apply before rendering.
*
* \param viewer
* Location of the viewer in world space.
*
* * \param volume
* The volume structure that can be used for culling.
*/
virtual void render(RenderViewType renderViewType,
RenderStateFlags globalFlagsMask,
const Matrix4& modelview,
const Matrix4& projection,
const Vector3& viewer,
const VolumeTest& volume) = 0;
virtual void realise() = 0;
virtual void unrealise() = 0;
/**
* Get the current render time in milliseconds.
*/
virtual std::size_t getTime() const = 0;
/**
* Set the render time in milliseconds.
*/
virtual void setTime(std::size_t milliSeconds) = 0;
/* SHADER PROGRAMS */
/// Available GL programs used for backend rendering.
enum ShaderProgram
{
/// No shader program (normal GL fixed-function pipeline)
SHADER_PROGRAM_NONE,
/// Lighting interaction shader
SHADER_PROGRAM_INTERACTION
};
/// Get the current shader program in use.
virtual ShaderProgram getCurrentShaderProgram() const = 0;
/// Set the shader program to use.
virtual void setShaderProgram(ShaderProgram prog) = 0;
virtual void attachRenderable(Renderable& renderable) = 0;
virtual void detachRenderable(Renderable& renderable) = 0;
virtual void forEachRenderable(const RenderableCallback& callback) const = 0;
// Initialises the OpenGL extensions
virtual void extensionsInitialised() = 0;
// Returns true if openGL supports ARB or GLSL lighting
virtual bool shaderProgramsAvailable() const = 0;
// Sets the flag whether shader programs are available.
virtual void setShaderProgramsAvailable(bool available) = 0;
// Activates or deactivates the merge render mode
virtual void setMergeModeEnabled(bool enabled) = 0;
// Subscription to get notified as soon as the openGL extensions have been initialised
virtual sigc::signal<void> signal_extensionsInitialised() = 0;
};
typedef std::shared_ptr<RenderSystem> RenderSystemPtr;
typedef std::weak_ptr<RenderSystem> RenderSystemWeakPtr;
/**
* \brief
* Global accessor method for the RenderSystem instance.
*/
inline RenderSystem& GlobalRenderSystem()
{
static module::InstanceReference<RenderSystem> _reference(MODULE_RENDERSYSTEM);
return _reference;
}