Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Instancing
SMeshInstancing.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2024 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#pragma once
26
27
#include "
irrlicht.h
"
28
using namespace
irr::scene
;
29
30
#include "Material/CMaterial.h"
31
#include "Material/Shader/Instancing/IShaderInstancing.h"
32
33
namespace
Skylicht
34
{
35
struct
SMeshInstancingGroup
;
36
37
// Use in CMeshRendererInstancing
38
struct
SMeshInstancing
39
{
40
// base source mesh buffers
41
core::array<IMeshBuffer*>
MeshBuffers;
42
43
// base source materials
44
core::array<CMaterial*>
Materials;
45
46
// shader instancing for batching
47
core::array<IShaderInstancing*>
InstancingShader;
48
49
// shader instancing handle (use on SkinnedInstancing)
50
IShaderInstancing
* HandleShader;
51
52
// vertex buffer, that batch materials (color, uv, sg, bone..)
53
core::array<IVertexBuffer*>
MaterialBuffer;
54
55
// vertex buffer, that batch transform
56
IVertexBuffer
* TransformBuffer;
57
58
// vertex buffer, that bake SH
59
IVertexBuffer
* IndirectLightingBuffer;
60
61
// mesh instancing, that will render
62
IMesh
* InstancingMesh;
63
64
// list buffers in InstancingMesh
65
core::array<IMeshBuffer*>
RenderMeshBuffers;
66
67
// list buffers in IndirectLightingMesh (CMesh property)
68
core::array<IMeshBuffer*>
RenderLightMeshBuffers;
69
70
// the group, that have many instances will be render
71
SMeshInstancingGroup
* InstancingGroup;
72
73
// the base mesh vertex type
74
video::E_VERTEX_TYPE
BaseVertexType;
75
76
// That tell us that, transform and lighting buffer is shared with another Mesh
77
bool
UseShareTransformBuffer;
78
bool
UseShareMaterialsBuffer;
79
80
int
* ShareDataTransform;
81
int
* ShareDataMaterials;
82
83
SMeshInstancing(
video::E_VERTEX_TYPE
vtxType)
84
{
85
HandleShader = NULL;
86
InstancingMesh = NULL;
87
TransformBuffer = NULL;
88
IndirectLightingBuffer = NULL;
89
InstancingGroup = NULL;
90
UseShareTransformBuffer =
false
;
91
UseShareMaterialsBuffer =
false
;
92
ShareDataTransform = NULL;
93
ShareDataMaterials = NULL;
94
BaseVertexType = vtxType;
95
}
96
97
~SMeshInstancing()
98
{
99
if
(HandleShader)
100
delete
HandleShader;
101
}
102
};
103
}
Skylicht::IShaderInstancing
Abstract base class for GPU instancing logic in Skylicht-Engine.
Definition
IShaderInstancing.h:45
irr::core::array
Self reallocating template array (like stl vector) with additional features.
Definition
irrArray.h:23
irr::scene::IMesh
Class which holds the geometry of an object.
Definition
IMesh.h:24
irr::scene::IVertexBuffer
Definition
IVertexBuffer.h:17
irrlicht.h
Main header file of the irrlicht, the only file needed to include.
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
irr::scene
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition
CIndexBuffer.h:13
irr::video::E_VERTEX_TYPE
E_VERTEX_TYPE
Enumeration for all vertex types there are.
Definition
S3DVertex.h:19
Skylicht::SMeshInstancingGroup
Definition
SMeshInstancingGroup.h:38
Generated by
1.17.0