sculpto
Namespaces | Classes | Typedefs | Enumerations | Functions
scl Namespace Reference

Namespaces

namespace  assets_manager
 
namespace  console
 
namespace  dx
 
namespace  math
 
namespace  topology
 

Classes

class  abstract
 
class  application_config_window
 
class  camera
 
struct  camera_component
 
struct  camera_effects
 
class  close_event
 
class  constant_buffer
 
struct  directional_light
 
struct  directional_light_component
 
class  event
 
class  event_dispatcher
 
struct  fixed_string
 
class  frame_buffer
 
struct  frame_buffer_props
 
class  gl
 
class  gl_constant_buffer
 
class  gl_frame_buffer
 
class  gl_index_buffer
 
class  gl_shader_program
 
class  gl_texture_2d
 
class  gl_vertex_array
 
class  gl_vertex_buffer
 
class  gui
 
class  image
 
class  index_buffer
 
class  input_system
 
struct  keyboard_data
 
class  keyboard_event
 
class  layers_stack
 
struct  lights_storage
 
class  log
 
class  logger
 
class  material
 
class  material_phong
 
class  material_single_color
 
class  mesh
 
struct  mesh_component
 
class  mouse_button_event
 
struct  mouse_data
 
class  mouse_move_event
 
class  mouse_wheel_event
 
struct  name_component
 
struct  native_script_component
 
struct  pipeline_data
 
struct  point_light
 
struct  point_light_component
 
class  profiller_window
 
class  render_bridge
 
class  render_context
 
struct  render_pipeline
 
class  renderer
 
class  scene
 
class  scene_config_window
 
class  scene_hierarchy_window
 
class  scene_object
 
class  scene_object_behaviour
 
class  scene_object_config_window
 
class  scene_serializer
 
class  shader_program
 
struct  shader_props
 
struct  spot_light
 
struct  spot_light_component
 
struct  submesh_props
 
struct  submission
 
class  texture_2d
 
class  timer
 
struct  transform_component
 
struct  vertex
 
class  vertex_array
 
class  vertex_buffer
 
struct  vertex_element
 
class  vertex_layout
 
struct  vertex_point
 
class  viewport_resize_event
 
class  viewport_window
 
class  window
 
class  windows_input_system
 
class  windows_window
 

Typedefs

using degrees = math::degrees< float >
 
using radians = math::radians< float >
 
using vec2 = math::vec2< float >
 
using vec3 = math::vec3< float >
 
using vec4 = math::vec4< float >
 
using ivec2 = math::vec2< int >
 
using ivec3 = math::vec3< int >
 
using ivec4 = math::vec4< int >
 
using uvec2 = math::vec2< u32 >
 
using uvec3 = math::vec3< u32 >
 
using uvec4 = math::vec4< u32 >
 
using matr3 = math::matr3< float >
 
using matr3_data = math::matr3_data< float >
 
using matr4 = math::matr4< float >
 
using matr4_data = math::matr4_data< float >
 
using window_handle = int
 
using scene_object_handle = entt::entity
 
using json = nlohmann::json
 
using i8 = int8_t
 
using u8 = uint8_t
 
using i16 = int16_t
 
using u16 = uint16_t
 
using i32 = int32_t
 
using u32 = uint32_t
 
using i64 = int64_t
 
using u64 = uint64_t
 
template<typename T >
using shared = std::shared_ptr< T >
 
template<typename T >
using unique = std::unique_ptr< T >
 
template<typename T >
using weak = std::weak_ptr< T >
 
using string_id = unsigned int
 

Enumerations

enum class  keycode : int {
  UNKNOWN = -1 , SPACE = 32 , A = 65 , B = 66 ,
  C = 67 , D = 68 , E = 69 , F = 70 ,
  G = 71 , H = 72 , I = 73 , J = 74 ,
  K = 75 , L = 76 , M = 77 , N = 78 ,
  O = 79 , P = 80 , Q = 81 , R = 82 ,
  S = 83 , T = 84 , U = 85 , V = 86 ,
  W = 87 , X = 88 , Y = 89 , Z = 90 ,
  F1 = 290 , F2 = 291 , F3 = 292 , F4 = 293 ,
  F5 = 294 , F6 = 295 , F7 = 296 , F8 = 297 ,
  F9 = 298 , F10 = 299 , F11 = 300 , F12 = 301 ,
  F13 = 302 , F14 = 303 , F15 = 304 , F16 = 305 ,
  F17 = 306 , F18 = 307 , F19 = 308 , F20 = 309 ,
  F21 = 310 , F22 = 311 , F23 = 312 , F24 = 313 ,
  F25 = 314
}
 
enum class  mouse_button { LEFT = 0 , RIGHT = 1 , MIDDLE = 2 }
 
enum class  usage_type : u8 {
  STREAM_DRAW , STREAM_READ , STREAM_COPY , STATIC_DRAW ,
  STATIC_READ , STATIC_COPY , DYNAMIC_DRAW , DYNAMIC_READ ,
  DYNAMIC_COPY
}
 
enum class  buffer_type : u8 { ARRAY , ELEMENT_ARRAY , SHADER_STORAGE }
 
enum class  shader_type { VERTEX , GEOMETRY , PIXEL , COMPUTE }
 
enum class  texture_type { COLOR , COLOR_FLOATING_POINT , DEPTH }
 
enum class  mesh_type {
  LINES , POINTS , PATCHES , TRIANGLES ,
  TRISTRIP
}
 
enum class  shader_variable_type : u8 {
  BOOL , INT , INT2 , INT3 ,
  INT4 , FLOAT , FLOAT2 , FLOAT3 ,
  FLOAT4 , MATR3 , MATR4
}
 
enum class  render_cull_face_mode { OFF , BACK , FRONT }
 
enum class  render_context_api { OpenGL , DirectX }
 
enum class  camera_projection_type { ORTHOGRAPHIC , PERSPECTIVE }
 

Functions

application * CreateApplication ()
 
void to_json (json &Json, const name_component &NameComponent)
 
void to_json (json &Json, const transform_component &TransformComponent)
 
void to_json (json &Json, const camera_component &CameraComponent)
 
void to_json (json &Json, const point_light_component &PointLightComponent)
 
void to_json (json &Json, const directional_light_component &DirectionalLightComponent)
 
void to_json (json &Json, const spot_light_component &SpotLightComponent)
 
bool from_json (const json &Json, name_component &NameComponent)
 
bool from_json (const json &Json, transform_component &TransformComponent)
 
bool from_json (const json &Json, camera_component &CameraComponent)
 
bool from_json (const json &Json, point_light_component &PointLightComponent)
 
bool from_json (const json &Json, directional_light_component &DirectionalLightComponent)
 
bool from_json (const json &Json, spot_light_component &SpotLightComponent)
 
std::ostream & operator<< (std::ostream &os, const event &e)
 
const std::string CurrentTime ()
 
void MemorySwap (void *BlockA, void *BlockB, size_t Size)
 
template<typename T , typename... Args>
constexpr shared< T > CreateShared (Args &&... args)
 
template<typename T , typename... Args>
constexpr unique< T > CreateUnique (Args &&... args)
 
template<size_t Length>
 fixed_string (const char(&str)[Length]) -> fixed_string< Length - 1 >
 
u32 SplitString (const std::string &String, std::string &Delimiter, std::vector< std::string > &OutputSequence)
 
constexpr string_id crc32_impl (const char *p, size_t len, string_id crc)
 
constexpr string_id crc32 (const char *data, size_t length)
 
constexpr size_t strlen_c (const char *str)
 
constexpr string_id StringId (const char *Str)
 
template<typename StringClass >
constexpr string_id StringId (const StringClass &Str)
 
constexpr string_id operator""_id (const char *Str, size_t Length)
 

Detailed Description

Standart types definition.

********** Point Light Contants ************* Distance Constant Linear Quadratic 0007, 1.0, 0.7 , 1.8 0013, 1.0, 0.35 , 0.44 0020, 1.0, 0.22 , 0.20 0032, 1.0, 0.14 , 0.07 0050, 1.0, 0.09 , 0.032 0065, 1.0, 0.07 , 0.017 0100, 1.0, 0.045 , 0.0075 0160, 1.0, 0.027 , 0.0028 0200, 1.0, 0.022 , 0.0019 0325, 1.0, 0.014 , 0.0007 0600, 1.0, 0.007 , 0.0002 3250, 1.0, 0.0014, 0.000007

Shader program class declaration.

Typedef Documentation

◆ degrees

using scl::degrees = typedef math::degrees<float>

Math module generic types.

Definition at line 35 of file base.h.

◆ i16

using scl::i16 = typedef int16_t

Definition at line 18 of file math_common.h.

◆ i32

using scl::i32 = typedef int32_t

Definition at line 20 of file math_common.h.

◆ i64

using scl::i64 = typedef int64_t

Definition at line 22 of file math_common.h.

◆ i8

using scl::i8 = typedef int8_t

Atomic types.

Definition at line 16 of file math_common.h.

◆ ivec2

using scl::ivec2 = typedef math::vec2<int>

Definition at line 40 of file base.h.

◆ ivec3

using scl::ivec3 = typedef math::vec3<int>

Definition at line 41 of file base.h.

◆ ivec4

using scl::ivec4 = typedef math::vec4<int>

Definition at line 42 of file base.h.

◆ json

using scl::json = typedef nlohmann::json

Definition at line 12 of file scene_serializer.h.

◆ matr3

using scl::matr3 = typedef math::matr3<float>

Definition at line 46 of file base.h.

◆ matr3_data

using scl::matr3_data = typedef math::matr3_data<float>

Definition at line 47 of file base.h.

◆ matr4

using scl::matr4 = typedef math::matr4<float>

4x4 Matrix friend class forward declaration.

Definition at line 48 of file base.h.

◆ matr4_data

using scl::matr4_data = typedef math::matr4_data<float>

Definition at line 49 of file base.h.

◆ radians

using scl::radians = typedef math::radians<float>

Definition at line 36 of file base.h.

◆ scene_object_handle

using scl::scene_object_handle = typedef entt::entity

Definition at line 23 of file scene.h.

◆ shared

template<typename T >
using scl::shared = typedef std::shared_ptr<T>

Shared smart pointer.

Definition at line 15 of file smart_ptr.h.

◆ string_id

using scl::string_id = typedef unsigned int

Definition at line 64 of file string_id.h.

◆ u16

using scl::u16 = typedef uint16_t

Definition at line 19 of file math_common.h.

◆ u32

using scl::u32 = typedef uint32_t

Definition at line 21 of file math_common.h.

◆ u64

using scl::u64 = typedef uint64_t

Definition at line 23 of file math_common.h.

◆ u8

using scl::u8 = typedef uint8_t

Definition at line 17 of file math_common.h.

◆ unique

template<typename T >
using scl::unique = typedef std::unique_ptr<T>

Unique smart pointer.

Definition at line 25 of file smart_ptr.h.

◆ uvec2

using scl::uvec2 = typedef math::vec2<u32>

Definition at line 43 of file base.h.

◆ uvec3

using scl::uvec3 = typedef math::vec3<u32>

Definition at line 44 of file base.h.

◆ uvec4

using scl::uvec4 = typedef math::vec4<u32>

Definition at line 45 of file base.h.

◆ vec2

using scl::vec2 = typedef math::vec2<float>

Definition at line 37 of file base.h.

◆ vec3

using scl::vec3 = typedef math::vec3<float>

Definition at line 38 of file base.h.

◆ vec4

using scl::vec4 = typedef math::vec4<float>

Definition at line 39 of file base.h.

◆ weak

template<typename T >
using scl::weak = typedef std::weak_ptr<T>

Weak smart pointer (do not increases counter).

Definition at line 35 of file smart_ptr.h.

◆ window_handle

using scl::window_handle = typedef int

Windows platform specific types

Definition at line 55 of file base.h.

Enumeration Type Documentation

◆ buffer_type

enum class scl::buffer_type : u8
strong

Buffer type enum.

Enumerator
ARRAY 
ELEMENT_ARRAY 
SHADER_STORAGE 

Definition at line 32 of file buffer.h.

◆ camera_projection_type

enum class scl::camera_projection_type
strong

Camera projection type enum.

Enumerator
ORTHOGRAPHIC 
PERSPECTIVE 

Definition at line 19 of file camera.h.

◆ keycode

enum class scl::keycode : int
strong

Input system platform independent key codes enum class.

Enumerator
UNKNOWN 
SPACE 
F1 
F2 
F3 
F4 
F5 
F6 
F7 
F8 
F9 
F10 
F11 
F12 
F13 
F14 
F15 
F16 
F17 
F18 
F19 
F20 
F21 
F22 
F23 
F24 
F25 

Definition at line 14 of file input_keycodes.h.

15 {
16 UNKNOWN = -1,
17 SPACE = 32,
18 A = 65,
19 B = 66,
20 C = 67,
21 D = 68,
22 E = 69,
23 F = 70,
24 G = 71,
25 H = 72,
26 I = 73,
27 J = 74,
28 K = 75,
29 L = 76,
30 M = 77,
31 N = 78,
32 O = 79,
33 P = 80,
34 Q = 81,
35 R = 82,
36 S = 83,
37 T = 84,
38 U = 85,
39 V = 86,
40 W = 87,
41 X = 88,
42 Y = 89,
43 Z = 90,
44#ifdef SCL_PLATFORM_WINDOWS
45 LBUTTON = 0x01,
46 RBUTTON = 0x02,
47 MBUTTON = 0x04,
48 BACK = 0x08,
49 TAB = 0x09,
50 RETURN = 0x0D,
51 SHIFT = 0x10,
52 CONTROL = 0x11,
53 ESCAPE = 0x1B,
54 END = 0x23,
55 HOME = 0x24,
56 LEFT = 0x25,
57 UP = 0x26,
58 RIGHT = 0x27,
59 DOWN = 0x28,
60 INSERT = 0x2D,
61 DEL = 0x2E,
62 HELP = 0x2F,
63 MULTIPLY = 0x6A,
64 ADD = 0x6B,
65 SEPARATOR = 0x6C,
66 SUBTRACT = 0x6D,
67 DIVIDE = 0x6F,
68 F1 = 0x70,
69 F2 = 0x71,
70 F3 = 0x72,
71 F4 = 0x73,
72 F5 = 0x74,
73 F6 = 0x75,
74 F7 = 0x76,
75 F8 = 0x77,
76 F9 = 0x78,
77 F10 = 0x79,
78 F11 = 0x7A,
79 F12 = 0x7B,
80 F13 = 0x7C,
81 F14 = 0x7D,
82 F15 = 0x7E,
83 F16 = 0x7F,
84 F17 = 0x80,
85 F18 = 0x81,
86 F19 = 0x82,
87 F20 = 0x83,
88 F21 = 0x84,
89 F22 = 0x85,
90 F23 = 0x86,
91 F24 = 0x87,
92#else // GLFW...
93 F1 = 290,
94 F2 = 291,
95 F3 = 292,
96 F4 = 293,
97 F5 = 294,
98 F6 = 295,
99 F7 = 296,
100 F8 = 297,
101 F9 = 298,
102 F10 = 299,
103 F11 = 300,
104 F12 = 301,
105 F13 = 302,
106 F14 = 303,
107 F15 = 304,
108 F16 = 305,
109 F17 = 306,
110 F18 = 307,
111 F19 = 308,
112 F20 = 309,
113 F21 = 310,
114 F22 = 311,
115 F23 = 312,
116 F24 = 313,
117 F25 = 314,
118#endif
119 };
const float E
Definition: math_common.h:28

◆ mesh_type

enum class scl::mesh_type
strong

Mesh types enum.

Enumerator
LINES 
POINTS 

Line segments (by 2 points)

PATCHES 

Array of points

TRIANGLES 

Tesselation patchesz

TRISTRIP 

Triangle mesh - array of triangles

Definition at line 17 of file vertex_array.h.

◆ mouse_button

enum class scl::mouse_button
strong
Enumerator
LEFT 
RIGHT 
MIDDLE 

Definition at line 15 of file mouse_event.h.

16 {
17#ifdef SCL_PLATFORM_WINDOWS
18 NONE = 0,
19 LEFT = 1,
20 RIGHT = 2,
21 MIDDLE = 16,
22#else
23 LEFT = 0,
24 RIGHT = 1,
25 MIDDLE = 2,
26#endif
27 };

◆ render_context_api

enum class scl::render_context_api
strong

Render context backend api enum.

Enumerator
OpenGL 
DirectX 

Definition at line 47 of file render_context.h.

◆ render_cull_face_mode

enum class scl::render_cull_face_mode
strong

Render contextu culling mode.

Enumerator
OFF 
BACK 
FRONT 

Definition at line 39 of file render_context.h.

◆ shader_type

enum class scl::shader_type
strong

Shader type enum.

Enumerator
VERTEX 
GEOMETRY 
PIXEL 
COMPUTE 

Definition at line 16 of file shader.h.

◆ shader_variable_type

enum class scl::shader_variable_type : u8
strong

Shader variable type enum.

Enumerator
BOOL 
INT 
INT2 
INT3 
INT4 
FLOAT 
FLOAT2 
FLOAT3 
FLOAT4 
MATR3 
MATR4 

Definition at line 23 of file render_context.h.

◆ texture_type

enum class scl::texture_type
strong

Texture types enum class.

Enumerator
COLOR 
COLOR_FLOATING_POINT 

Default color texture type.

DEPTH 

High dynamic range color texture type.

Definition at line 17 of file texture.h.

◆ usage_type

enum class scl::usage_type : u8
strong

Buffer usage enum.

Enumerator
STREAM_DRAW 
STREAM_READ 
STREAM_COPY 
STATIC_DRAW 
STATIC_READ 
STATIC_COPY 
DYNAMIC_DRAW 
DYNAMIC_READ 
DYNAMIC_COPY 

Definition at line 18 of file buffer.h.

Function Documentation

◆ crc32()

constexpr string_id scl::crc32 ( const char *  data,
size_t  length 
)
constexpr

Definition at line 73 of file string_id.h.

73 {
74 return ~crc32_impl(data, length, ~0);
75 }

◆ crc32_impl()

constexpr string_id scl::crc32_impl ( const char *  p,
size_t  len,
string_id  crc 
)
constexpr

Definition at line 66 of file string_id.h.

66 {
67 return
68 len ?
69 crc32_impl(p + 1, len - 1, (crc >> 8) ^ crc_table[(crc & 0xFF) ^ *p]) :
70 crc;
71 }
constexpr string_id crc32_impl(const char *p, size_t len, string_id crc)
Definition: string_id.h:66

◆ CreateApplication()

scl::application * scl::CreateApplication ( )

◆ CreateShared()

template<typename T , typename... Args>
constexpr shared< T > scl::CreateShared ( Args &&...  args)
constexpr

Definition at line 18 of file smart_ptr.h.

19 {
20 return std::make_shared<T>(std::forward<Args>(args)...);
21 }

◆ CreateUnique()

template<typename T , typename... Args>
constexpr unique< T > scl::CreateUnique ( Args &&...  args)
constexpr

Definition at line 28 of file smart_ptr.h.

29 {
30 return std::make_unique<T>(std::forward<Args>(args)...);
31 }

◆ CurrentTime()

const std::string scl::CurrentTime ( )
inline
  • Getting curent time string function.
Parameters
None.
Returns
Current time as string in format HH:MM:SS.

Definition at line 19 of file current_time.h.

20 {
21 using sysclock_t = std::chrono::system_clock;
22 std::time_t now = sysclock_t::to_time_t(sysclock_t::now());
23 tm local_time;
24 localtime_s(&local_time, &now);
25
26 char buf[16] = { 0 };
27 std::strftime(buf, sizeof(buf), "%H:%M:%S", &local_time);
28
29 return std::string(buf);
30 }

◆ fixed_string()

template<size_t Length>
scl::fixed_string ( const char(&)  str[Length]) -> fixed_string< Length - 1 >

Fixed length string class constructor with deduced template.

◆ from_json() [1/6]

bool scl::from_json ( const json Json,
camera_component CameraComponent 
)

Definition at line 99 of file scene_serializer.cpp.

100{
101 const auto &is_primary = Json.find("is_primary");
102 const auto &projection_type = Json.find("projection_type");
103 const auto &fov = Json.find("fov");
104 const auto &position = Json.find("position");
105 const auto &focus_point = Json.find("focus_point");
106 const auto &up_direction = Json.find("up_direction");
107 const auto &viewport_width = Json.find("viewport_width");
108 const auto &viewport_height = Json.find("viewport_height");
109
110 auto &camera = CameraComponent.Camera;
111 if (is_primary != Json.end()) CameraComponent.IsPrimary = is_primary->get<bool>();
112 if (projection_type != Json.end()) camera.SetProjectionType((camera_projection_type)projection_type->get<int>());
113 if (fov != Json.end()) camera.SetFieldOfView(fov->get<float>());
114 if (position != Json.end()) camera.SetPosition(position->get<vec3>());
115 if (focus_point != Json.end()) camera.SetFocus(focus_point->get<vec3>());
116 if (up_direction != Json.end()) camera.SetUpDirection(up_direction->get<vec3>());
117 if (viewport_width != Json.end()) camera.SetViewportWidth(viewport_width->get<int>());
118 if (viewport_height != Json.end()) camera.SetViewportHeight(viewport_height->get<int>());
119
120 const auto &effects = Json.find("effects");
121 if (effects != Json.end())
122 {
123 const auto &effects_is_hdr = effects->find("is_hdr");
124 const auto &effects_exposure = effects->find("exposure");
125 const auto &effects_is_bloom = effects->find("is_bloom");
126 const auto &effects_bloom_amount = effects->find("bloom_amount");
127
128 if (effects_is_hdr != effects->end()) camera.Effects.HDR = effects_is_hdr->get<bool>();
129 if (effects_exposure != effects->end()) camera.Effects.Exposure = effects_exposure->get<float>();
130 if (effects_is_bloom != effects->end()) camera.Effects.Bloom = effects_is_bloom->get<bool>();
131 if (effects_bloom_amount != effects->end()) camera.Effects.BloomAmount = effects_bloom_amount->get<int>();
132 }
133 return true;
134}
void SetProjectionType(camera_projection_type ProjectionType)
Definition: camera.cpp:13
void SetFieldOfView(float FieldOfView)
Definition: camera.cpp:18
void SetViewportHeight(int ViewportHeight)
Definition: camera.cpp:38
camera_effects Effects
Definition: camera.h:74
void SetPosition(const vec3 &Position)
Definition: camera.cpp:55
void SetUpDirection(const vec3 &UpDirection)
Definition: camera.cpp:43
void SetViewportWidth(int ViewportWidth)
Definition: camera.cpp:33
void SetFocus(const vec3 &Focus)
Definition: camera.cpp:62
camera_projection_type
Definition: camera.h:20

◆ from_json() [2/6]

bool scl::from_json ( const json Json,
directional_light_component DirectionalLightComponent 
)

Definition at line 152 of file scene_serializer.cpp.

153{
154 const auto &color = Json.find("color");
155 const auto &strength = Json.find("strength");
156 const auto &is_casting_shadows = Json.find("is_casting_shadows");
157 const auto &projection_box_size = Json.find("projection_box_size");
158 const auto &projection_box_depth = Json.find("projection_box_depth");
159 const auto &shadow_map_width = Json.find("shadow_map_width");
160 const auto &shadow_map_height = Json.find("shadow_map_height");
161
162 if (color != Json.end()) DirectionalLightComponent.Color = color->get<vec3>();
163 if (strength != Json.end()) DirectionalLightComponent.Strength = strength->get<float>();
164 if (is_casting_shadows != Json.end()) DirectionalLightComponent.SetIsShadows(is_casting_shadows->get<bool>());
165 if (projection_box_size != Json.end()) DirectionalLightComponent.SetBoxSize(projection_box_size->get<float>());
166 if (projection_box_depth != Json.end()) DirectionalLightComponent.SetBoxDepth(projection_box_depth->get<float>());
167 if (shadow_map_width != Json.end()) DirectionalLightComponent.SetShadowMapWidth(shadow_map_width->get<int>());
168 if (shadow_map_height != Json.end()) DirectionalLightComponent.SetShadowMapHeight(shadow_map_height->get<int>());
169 return true;
170}

◆ from_json() [3/6]

bool scl::from_json ( const json Json,
name_component NameComponent 
)

Definition at line 78 of file scene_serializer.cpp.

79{
80 const auto &name = Json.find("name");
81 if (name == Json.end()) return false;
82
83 NameComponent.Name = name->get<std::string>();
84 return true;
85}

◆ from_json() [4/6]

bool scl::from_json ( const json Json,
point_light_component PointLightComponent 
)

Definition at line 136 of file scene_serializer.cpp.

137{
138 const auto &color = Json.find("color");
139 const auto &strength = Json.find("strength");
140 const auto &constant_attitution = Json.find("constant_attitution");
141 const auto &linear_attitution = Json.find("linear_attitution");
142 const auto &quadratic_attitution = Json.find("quafratic_attitution");
143
144 if (color != Json.end()) PointLightComponent.Color = color->get<vec3>();
145 if (strength != Json.end()) PointLightComponent.Strength = strength->get<float>();
146 if (constant_attitution != Json.end()) PointLightComponent.Constant = constant_attitution->get<float>();
147 if (linear_attitution != Json.end()) PointLightComponent.Linear = linear_attitution->get<float>();
148 if (quadratic_attitution != Json.end()) PointLightComponent.Quadratic = quadratic_attitution->get<float>();
149 return true;
150}

◆ from_json() [5/6]

bool scl::from_json ( const json Json,
spot_light_component SpotLightComponent 
)

Definition at line 172 of file scene_serializer.cpp.

173{
174 const auto &color = Json.find("color");
175 const auto &strength = Json.find("strength");
176 const auto &inner_cutoff_angle = Json.find("inner_cutoff_angle");
177 const auto &outer_cutoff_angle = Json.find("outer_cutoff_angle");
178
179 if (color != Json.end()) SpotLightComponent.Color = color->get<vec3>();
180 if (strength != Json.end()) SpotLightComponent.Strength = strength->get<float>();
181 if (inner_cutoff_angle != Json.end()) SpotLightComponent.SetInnerCutoff(inner_cutoff_angle->get<float>());
182 if (outer_cutoff_angle != Json.end()) SpotLightComponent.SetOuterCutoff(outer_cutoff_angle->get<float>());
183 return true;
184}
void SetOuterCutoff(degrees Angle)
void SetInnerCutoff(degrees Angle)

◆ from_json() [6/6]

bool scl::from_json ( const json Json,
transform_component TransformComponent 
)

Definition at line 87 of file scene_serializer.cpp.

88{
89 const auto &scale = Json.find("scale");
90 const auto &angles = Json.find("angles");
91 const auto &position = Json.find("position");
92
93 if (scale != Json.end()) TransformComponent.SetScale(scale->get<vec3>());
94 if (angles != Json.end()) TransformComponent.SetAngles(angles->get<vec3>());
95 if (position != Json.end()) TransformComponent.SetPosition(position->get<vec3>());
96 return true;
97}
void SetPosition(const vec3 &Position)
void SetAngles(const vec3 &Angles)
void SetScale(const vec3 &Scale)

◆ MemorySwap()

void scl::MemorySwap ( void *  BlockA,
void *  BlockB,
size_t  Size 
)
inline
  • Swap momory blocks function.
Parameters
BlockA- first memory block.
BlockB- second memory block.
Size- blocks size in bytes.
Returns
None.

Definition at line 23 of file memory_swap.h.

24 {
25 u8 *a_swap = (u8 *)BlockA, *b_swap = (u8 *)BlockB;
26 u8 *a_end = a_swap + Size;
27
28 while (a_swap < a_end)
29 {
30 char temp = *a_swap;
31 *a_swap = *b_swap;
32 *b_swap = temp;
33
34 a_swap++, b_swap++;
35 }
36 }
uint8_t u8
Definition: math_common.h:17

◆ operator""_id()

constexpr string_id scl::operator""_id ( const char *  Str,
size_t  Length 
)
constexpr
  • Generate string id using crc32 algorithm function.
Parameters
Str- srting to genrerate id of.
Returns
id of string.

Definition at line 108 of file string_id.h.

109 {
110 return crc32((char *)Str, Length);
111 }
constexpr string_id crc32(const char *data, size_t length)
Definition: string_id.h:73

◆ operator<<()

std::ostream & scl::operator<< ( std::ostream &  os,
const event e 
)
inline

Definition at line 57 of file event.h.

58 {
59 return os << e.ToString();
60 }
virtual std::string ToString() const
Definition: event.h:54

◆ SplitString()

u32 scl::SplitString ( const std::string &  String,
std::string &  Delimiter,
std::vector< std::string > &  OutputSequence 
)
  • Split strign function.
Parameters
String- string to split.
Delimiter- delimiter character or string.
[out]OutputSequence- array of cplitted by delimiter strings.
Returns
count of splited strings.

Definition at line 23 of file split_string.h.

24 {
25 }

◆ StringId() [1/2]

constexpr string_id scl::StringId ( const char *  Str)
constexpr
  • Generate string id using crc32 algorithm function.
Parameters
Str- srting to genrerate id of.
Returns
id of string.

Definition at line 87 of file string_id.h.

87 {
88 return crc32((char *)Str, strlen_c(Str));
89 }
constexpr size_t strlen_c(const char *str)
Definition: string_id.h:77

◆ StringId() [2/2]

template<typename StringClass >
constexpr string_id scl::StringId ( const StringClass &  Str)
constexpr
  • Generate string id using crc32 algorithm function.
Parameters
Str- srting to genrerate id of.
Returns
id of string.

Definition at line 98 of file string_id.h.

98 {
99 return crc32(&Str[0], Str.size());
100 }

◆ strlen_c()

constexpr size_t scl::strlen_c ( const char *  str)
constexpr

Definition at line 77 of file string_id.h.

77 {
78 return *str ? 1 + strlen_c(str + 1) : 0;
79 }

◆ to_json() [1/6]

void scl::to_json ( json Json,
const camera_component CameraComponent 
)

Definition at line 31 of file scene_serializer.cpp.

32{
33 const auto &camera = CameraComponent.Camera;
34 Json["is_primary"] = CameraComponent.IsPrimary;
35 Json["projection_type"] = (int)camera.GetProjectionType();
36 Json["fov"] = camera.GetFieldOfView();
37 Json["position"] = camera.GetPosition();
38 Json["focus_point"] = camera.GetFocus();
39 Json["up_direction"] = camera.GetUpDirection();
40 Json["viewport_width"] = camera.GetViewportWidth();
41 Json["viewport_height"] = camera.GetViewportHeight();
42 Json["effects"] = {
43 { "is_hdr", camera.Effects.HDR },
44 { "exposure", camera.Effects.Exposure },
45 { "is_bloom", camera.Effects.Bloom },
46 { "bloom_amount", camera.Effects.BloomAmount }
47 };
48}
const vec3 & GetUpDirection() const
Definition: camera.h:102
int GetViewportWidth() const
Definition: camera.h:93
const vec3 & GetFocus() const
Definition: camera.h:110
camera_projection_type GetProjectionType() const
Definition: camera.h:85
float GetFieldOfView() const
Definition: camera.h:87
const vec3 & GetPosition() const
Definition: camera.h:108
int GetViewportHeight() const
Definition: camera.h:95

◆ to_json() [2/6]

void scl::to_json ( json Json,
const directional_light_component DirectionalLightComponent 
)

Definition at line 59 of file scene_serializer.cpp.

60{
61 Json["color"] = DirectionalLightComponent.Color;
62 Json["strength"] = DirectionalLightComponent.Strength;
63 Json["is_casting_shadows"] = DirectionalLightComponent.GetIsShadow();
64 Json["projection_box_size"] = DirectionalLightComponent.GetBoxSize();
65 Json["projection_box_depth"] = DirectionalLightComponent.GetBoxDepth();
66 Json["shadow_map_width"] = DirectionalLightComponent.GetShadowMapWidth();
67 Json["shadow_map_height"] = DirectionalLightComponent.GetShadowMapHeight();
68}

◆ to_json() [3/6]

void scl::to_json ( json Json,
const name_component NameComponent 
)

Components serialization/deserialization to json format functions.

Definition at line 19 of file scene_serializer.cpp.

20{
21 Json["name"] = NameComponent.Name;
22}

◆ to_json() [4/6]

void scl::to_json ( json Json,
const point_light_component PointLightComponent 
)

Definition at line 50 of file scene_serializer.cpp.

51{
52 Json["color"] = PointLightComponent.Color;
53 Json["strength"] = PointLightComponent.Strength;
54 Json["constant_attitution"] = PointLightComponent.Constant;
55 Json["linear_attitution"] = PointLightComponent.Linear;
56 Json["quafratic_attitution"] = PointLightComponent.Quadratic;
57}

◆ to_json() [5/6]

void scl::to_json ( json Json,
const spot_light_component SpotLightComponent 
)

Definition at line 70 of file scene_serializer.cpp.

71{
72 Json["color"] = SpotLightComponent.Color;
73 Json["strength"] = SpotLightComponent.Strength;
74 Json["inner_cutoff_angle"] = SpotLightComponent.GetInnerCutoff();
75 Json["outer_cutoff_angle"] = SpotLightComponent.GetOuterCutoff();
76}

◆ to_json() [6/6]

void scl::to_json ( json Json,
const transform_component TransformComponent 
)

Definition at line 24 of file scene_serializer.cpp.

25{
26 Json["scale"] = TransformComponent.Scale;
27 Json["angles"] = TransformComponent.Angles;
28 Json["position"] = TransformComponent.Position;
29}