3#ifndef GDK_GFX_WEBGL1ES2_SCENE
4#define GDK_GFX_WEBGL1ES2_SCENE
7#include <gdk/webgl1es2_material.h>
8#include <gdk/webgl1es2_model.h>
9#include <gdk/webgl1es2_screen_camera.h>
10#include <gdk/webgl1es2_texture_camera.h>
12#include <unordered_set>
19 using entity_ptr_type = std::shared_ptr<const entity>;
20 using material_ptr_type = std::shared_ptr<webgl1es2_material>;
21 using model_ptr_type = std::shared_ptr<webgl1es2_model>;
22 using model_to_entity_collection = std::unordered_map<model_ptr_type,
23 std::unordered_set<entity_ptr_type>>;
24 using material_to_model_to_entity_collection_collection =
25 std::unordered_map<material_ptr_type, model_to_entity_collection>;
29 virtual void try_add(entity_ptr_type);
34 material_to_model_to_entity_collection_collection m_MaterialToModelToEntityCollection;
36 std::unordered_set<entity_ptr_type> m_unique_entities;
43 virtual void try_add(entity_ptr_type)
override;
45 sorted_render_set() =
default;
62 std::unordered_set<std::shared_ptr<const entity>>>;
66 std::unordered_map<material_ptr_type, model_to_entity_collection>;
72 virtual void add(
const std::shared_ptr<const screen_camera> &pCamera)
override;
73 virtual void add(
const std::shared_ptr<const texture_camera> &pCamera)
override;
74 virtual void add(
const std::shared_ptr<const entity> &pEntity)
override;
76 virtual void remove(
const std::shared_ptr<const screen_camera> &pCamera)
override;
77 virtual void remove(
const std::shared_ptr<const texture_camera> &pCamera)
override;
78 virtual void remove(
const std::shared_ptr<const entity> &pEntity)
override;
80 virtual void draw(
const gdk::graphics_intvector2_type &aFrameBufferSize)
const override;
85 std::unordered_set<std::shared_ptr<const webgl1es2_screen_camera>> m_screen_cameras;
88 std::unordered_set<std::shared_ptr<const webgl1es2_texture_camera>> m_texture_cameras;
set of objects to render
Definition webgl1es2_scene.h:17
a 3d environment within which cameras draw entities
Definition scene.h:16
Definition webgl1es2_scene.h:39
webgl1es2_camera implementation of camera
Definition webgl1es2_camera.h:21
render scene.
Definition webgl1es2_scene.h:52
virtual void remove(const std::shared_ptr< const entity > &pEntity) override
remove an entity from the scene
std::unordered_map< model_ptr_type, std::unordered_set< std::shared_ptr< const entity > > > model_to_entity_collection
Definition webgl1es2_scene.h:61
virtual void add(const std::shared_ptr< const entity > &pEntity) override
add an entity to the scene
virtual void add(const std::shared_ptr< const screen_camera > &pCamera) override
add a screen camera to the scene
std::shared_ptr< webgl1es2_model > model_ptr_type
models can be shared across webgl1es2_scenes
Definition webgl1es2_scene.h:57
std::shared_ptr< webgl1es2_material > material_ptr_type
materials can be shared across webgl1es2_scenes
Definition webgl1es2_scene.h:55
virtual void remove(const std::shared_ptr< const screen_camera > &pCamera) override
remove a screen camera from the scene
virtual void draw(const gdk::graphics_intvector2_type &aFrameBufferSize) const override
draws the scene
virtual void remove(const std::shared_ptr< const texture_camera > &pCamera) override
remove a texture camera from the scene
std::unordered_map< material_ptr_type, model_to_entity_collection > material_to_model_to_entity_collection_collection
Definition webgl1es2_scene.h:65
virtual void add(const std::shared_ptr< const texture_camera > &pCamera) override
add a texture camera to the scene