Vigilante Game Framework  1.0.0.8
A 2D/3D C++ Game Framework using SFML.
Public Types | Public Member Functions | Public Attributes | List of all members
V3DScene Class Reference

A special VRenderGroup for Rendering 3D scenes. More...

#include <V3DScene.h>

Inheritance diagram for V3DScene:
VRenderGroup VGroup VBase

Public Types

typedef VRenderGroup VSUPERCLASS
 Used to call parent class functions when they are overrided in class.
 
- Public Types inherited from VRenderGroup
enum  VRenderGroupOutside : unsigned char { VRENDERGROUP_NO, VRENDERGROUP_BEFORE, VRENDERGROUP_AFTER, VRENDERGROUP_BOTH }
 Options for what happens to renderable objects outside of the VRenderGroup area. More...
 
typedef VGroup VSUPERCLASS
 Used to call parent class functions when they are overrided in class.
 
- Public Types inherited from VGroup
typedef VBase VSUPERCLASS
 Used to call parent class functions when they are overrided in class.
 

Public Member Functions

 V3DScene (float x, float y, unsigned int width, unsigned int height, const sf::ContextSettings &settings=sf::ContextSettings(), unsigned int maxSize=0)
 
 V3DScene (sf::Vector2f position, sf::Vector2u size, const sf::ContextSettings &settings=sf::ContextSettings(), unsigned int maxSize=0)
 
virtual const sf::Texture & GetTexture () override
 
const sf::Texture GetTexture (V3DShader *shader, V3DCamera *camera)
 
virtual void Resize (int width, int height) override
 
void SetActive (bool value=true)
 
void PushGLStates ()
 Push all the GL States up the stack to preserve them from any changes.
 
void PopGLStates ()
 Pop all the GL States off the stack to restore them.
 
void ResetGLStates ()
 Reset all the GL States.
 
virtual void Destroy () override
 Removes and/or destroys all objects inside the group and sprite before destroying extra data. (If an object is referenced in another VGroup, the object won't be destroyed)
 
virtual void Update (float dt) override
 
virtual void Draw (sf::RenderTarget &RenderTarget) override
 
- Public Member Functions inherited from VRenderGroup
 VRenderGroup (unsigned int maxSize=0)
 Default Constructor for VRenderGroup.
 
 VRenderGroup (float x, float y, unsigned int width, unsigned int height, unsigned int maxSize=0)
 
 VRenderGroup (sf::Vector2f position, sf::Vector2u size, unsigned int maxSize=0)
 
virtual void Kill () override
 Kills all living objects before killing the group and the sprite themselves.
 
virtual void Revive () override
 Revives all dead objects before reviving the group and the sprite themselves.
 
- Public Member Functions inherited from VGroup
 VGroup (unsigned int maxSize=0)
 
int Length ()
 
VBaseAdd (VBase *object)
 
VBaseRemove (VBase *object, bool splice=false)
 
VBaseFirstAvailable ()
 
int FirstNULL ()
 
VBaseFirstExisting ()
 
VBaseFirstAlive ()
 
VBaseFirstDead ()
 
int CountAlive (bool Recursive=false)
 
int CountDead (bool Recursive=false)
 
VBaseGetRandom (int min=0, int max=0)
 
void ForEach (std::function< void(VBase *)> function, bool recursive=false)
 
void ForEachAlive (std::function< void(VBase *)> function, bool recursive=false)
 
void ForEachDead (std::function< void(VBase *)> function, bool recursive=false)
 
void ForEachExists (std::function< void(VBase *)> function, bool recursive=false)
 
VBaseGetGroupItem (int index)
 
template<class T >
T * GetGroupItemAsType (int index)
 
int GetIndexOfItem (VBase *object)
 
void OrganiseNULLS ()
 Sort nullptr members to the bottom of the group.
 
void Swap (int a, int b)
 
void Sort (std::function< bool(VBase *, VBase *)> func)
 
void Reverse ()
 Reverse order of group.
 
void Clear ()
 Clears the whole group (does not destroy any of the members, that must be done using the Destroy method).
 

Public Attributes

unsigned int CurrentCamera = 0
 Current Camera Index for rendering.
 
std::unique_ptr< V3DShaderShader
 OpenGL Shader for the entire scene.
 
std::vector< std::unique_ptr< V3DCamera > > Camera
 Main 3D Camera for this scene.
 
- Public Attributes inherited from VRenderGroup
std::unique_ptr< VSpriteSprite = nullptr
 The sprite that the group will render to. Refer to this if you want to transform the render output.
 
sf::Color BackgroundTint = sf::Color::Transparent
 The background colour the sprite will have.
 
std::unique_ptr< VPostEffectBasePostEffect = nullptr
 Post Process (Shader) Effect to apply to the sprite.
 
std::unique_ptr< VCameraCamera = nullptr
 Camera for the sprite's render view.
 
bool RenderViewTransform = true
 If true, the camera's render view will be transformed based on the sprite's current transform, else it will use the camera's render view.
 
VRenderGroupOutside RenderOutside = VRENDERGROUP_NO
 If true, the content data would also be rendered outside of the sprite area. Used if you want an effect to apply to a specific area.
 
- Public Attributes inherited from VBase
bool active = true
 Base can be updated using Update if true.
 
bool visible = true
 Base can be rendered using Draw if true.
 
bool alive = true
 Helper member that is mainly used filter out behaviours to objects which aren't alive in the scene.
 
bool exists = true
 Base can be updated and rendered if true, else it would no longer be treated as being part of the scene.
 
VType type = NONE
 Base object type, typically set in the constructor of an inherited object to specify what type it is.
 
uint32_t RefCount = 0
 Counts the amount of times the object is referenced in groups, ensures an object is only destroyed when no longer part of a single group.
 

Additional Inherited Members

- Static Public Member Functions inherited from VBase
static const wchar_t * VString (const char *fmt,...)
 
static void VLog (const char *fmt,...)
 
static void VLogError (const char *fmt,...)
 
static void VClearLog ()
 
- Protected Member Functions inherited from VRenderGroup
void updateTransform ()
 Updates the transform.
 
void updateTexture (const sf::Texture &texture)
 Update the texture of the sprite.
 
- Protected Attributes inherited from VRenderGroup
sf::RenderTexture renderTex
 The sf::RenderTexture to render all the objects to.
 
sf::RenderTexture postProcessTex
 Another sf::RenderTexture for outputting the post process effect onto.
 
- Protected Attributes inherited from VGroup
std::vector< VBase * > members
 VBase List.
 
int length = 0
 Current amount of members in the list.
 
unsigned int MaxSize = 0
 Maximum Size of the list, used if VGroup is set to have a fixed size.
 

Detailed Description

A special VRenderGroup for Rendering 3D scenes.

Constructor & Destructor Documentation

◆ V3DScene() [1/2]

V3DScene::V3DScene ( float  x,
float  y,
unsigned int  width,
unsigned int  height,
const sf::ContextSettings &  settings = sf::ContextSettings(),
unsigned int  maxSize = 0 
)
Parameters
xX position of the sprite.
yY position of the sprite
widthWidth of the sprite (also sets the width of the render area).
heightHeight of the sprite (also sets the height of the render area).
settingsThe settings of the OpenGL Context that the sf::RenderTexture will have.
maxSizeThe fixed length of the group. If 0, then the VGroup has no limit in size.

◆ V3DScene() [2/2]

V3DScene::V3DScene ( sf::Vector2f  position,
sf::Vector2u  size,
const sf::ContextSettings &  settings = sf::ContextSettings(),
unsigned int  maxSize = 0 
)
Parameters
positionPosition of the sprite.
sizeSize of the sprite (also sets the size of the render area).
settingsThe settings of the OpenGL Context that the sf::RenderTexture will have.
maxSizeThe fixed length of the group. If 0, then the VGroup has no limit in size.

Member Function Documentation

◆ Draw()

virtual void V3DScene::Draw ( sf::RenderTarget &  RenderTarget)
overridevirtual

Renders all alive and visible objects in the group.

Parameters
RenderTargetThe game's sf::RenderTarget object to render data onto.

Reimplemented from VRenderGroup.

◆ GetTexture() [1/2]

virtual const sf::Texture& V3DScene::GetTexture ( )
overridevirtual
Returns
The rendered scene as a texture.

Reimplemented from VRenderGroup.

◆ GetTexture() [2/2]

const sf::Texture V3DScene::GetTexture ( V3DShader shader,
V3DCamera camera 
)

Renders the scene

Parameters
shaderThe scene shader.
cameraThe scene camera.
Returns
The rendered scene as a texture.

◆ Resize()

virtual void V3DScene::Resize ( int  width,
int  height 
)
overridevirtual

Resizes sprite and render area of the group.

Parameters
widthWidth of the sprite and texture area.
heightHeight of the sprite and texture area.

Reimplemented from VRenderGroup.

◆ SetActive()

void V3DScene::SetActive ( bool  value = true)
Parameters
valueIf true, sets the scene to be the current active context.

◆ Update()

virtual void V3DScene::Update ( float  dt)
overridevirtual

Updates all alive and active objects in the group.

Parameters
dtDelta Time between the previous and current frame.

Reimplemented from VRenderGroup.


The documentation for this class was generated from the following file: