-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathELibRendering.cpp
212 lines (169 loc) · 7.49 KB
/
ELibRendering.cpp
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
/*
This file is part of the E_Rendering library.
Copyright (C) 2009-2012 Benjamin Eikel <[email protected]>
Copyright (C) 2009-2012 Claudius Jähn <[email protected]>
Copyright (C) 2009-2012 Ralf Petring <[email protected]>
This library is subject to the terms of the Mozilla Public License, v. 2.0.
You should have received a copy of the MPL along with this library; see the
file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "ELibRendering.h"
#include <sstream>
#include "E_BufferObject.h"
#include "E_Draw.h"
#include "E_FBO.h"
#include "E_OcclusionQuery.h"
#include "E_ParameterStructs.h"
#include "E_RenderingContext.h"
#include "E_StatisticsQuery.h"
#include "E_TextRenderer.h"
#include "Mesh/E_Mesh.h"
#include "Mesh/E_VertexAccessor.h"
#include "Mesh/E_VertexAttributeAccessors.h"
#include "Mesh/E_VertexAttribute.h"
#include "Mesh/E_VertexDescription.h"
#include "MeshUtils/E_MeshBuilder.h"
#include "MeshUtils/E_MeshUtils.h"
#include "MeshUtils/E_PlatonicSolids.h"
#include "MeshUtils/E_PrimitiveShapes.h"
#include "MeshUtils/E_TriangleAccessor.h"
#include "MeshUtils/E_ConnectivityAccessor.h"
#include "MeshUtils/E_WireShapes.h"
#include "Shader/E_Shader.h"
#include "Shader/E_Uniform.h"
#include "Texture/E_Texture.h"
#include "Texture/E_TextureUtils.h"
#include <Rendering/Mesh/MeshDataStrategy.h>
#include <Rendering/Helper.h>
#include <Rendering/Serialization/StreamerXYZ.h>
#include <Rendering/Serialization/Serialization.h>
#include <Rendering/Texture/Texture.h>
#include <Rendering/Texture/TextureUtils.h>
#include <Util/IO/FileName.h>
#include <EScript/Basics.h>
#include <EScript/StdObjects.h>
#include <iostream>
namespace E_Rendering{
using namespace EScript;
using namespace Rendering;
//using namespace E_Geometry;
using namespace Geometry;
//using namespace E_Util;
//! E_MeshDataStrategy ---> EScript::ReferenceObject<MeshDataStrategy *>
struct E_MeshDataStrategy:public EScript::ReferenceObject<MeshDataStrategy *>{
ES_PROVIDES_TYPE_NAME(MeshDataStrategy)
public:
E_MeshDataStrategy(MeshDataStrategy * s):EScript::ReferenceObject<MeshDataStrategy *>(s){}
virtual ~E_MeshDataStrategy() {}
MeshDataStrategy * get() const { return ref(); }
};
// ---------------------------------------------------------
void init(EScript::Namespace * globals) {
Namespace * lib=new Namespace();
declareConstant(globals,"Rendering",lib);
//! @defgroup draw Draw
//! @{
E_Draw::init(*lib);
E_TextRenderer::init(*lib);
//! @}
//! @defgroup mesh Meshes
//! @{
E_Mesh::init(*lib);
E_MeshBuilder::init(*lib);
E_PlatonicSolids::init(lib);
E_PrimitiveShapes::init(lib);
E_WireShapes::init(lib);
E_VertexAccessor::init(*lib);
E_VertexAttributeAccessor::init(*lib);
E_VertexAttribute::init(*lib);
E_VertexDescription::init(*lib);
E_TriangleAccessor::init(*lib);
E_ConnectivityAccessor::init(*lib);
E_MeshUtils::init(lib);
//! @}
//! @defgroup context Rendering Context
//! @{
E_RenderingContext::init(*lib);
E_ParameterStructs::init(*lib);
E_BufferObject::init(*lib);
E_FBO::init(*lib);
//! @}
//! @defgroup rendering_helper Helper
//! @{
E_OcclusionQuery::init(*lib);
E_StatisticsQuery::init(*lib);
//! @}
//! @defgroup shader Shaders
//! @{
E_Shader::init(*lib);
E_Uniform::init(*lib);
//! @}
//! @defgroup texture Textures
//! @{
E_Texture::init(*lib);
E_TextureUtils::init(lib);
//! @}
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// MeshDataStrategy
//! @addtogroup mesh
//! @{
//! [ESF] void Rendering.setDefaultMeshDataStrategy(MeshDataStrategy)
ES_FUN(lib,"setDefaultMeshDataStrategy",1,1,(
MeshDataStrategy::setDefaultStrategy(EScript::assertType<E_MeshDataStrategy>(rt,parameter[0])->get()),EScript::create(nullptr)))
//! MeshDataStrategy Rendering.getDefaultMeshDataStrategy()
ES_FUN(lib,"getDefaultMeshDataStrategy",0,0,new E_MeshDataStrategy(MeshDataStrategy::getDefaultStrategy()))
//! MeshDataStrategy Rendering.getPureLocalStrategy()
ES_FUN(lib,"getPureLocalStrategy",0,0,
new E_MeshDataStrategy(SimpleMeshDataStrategy::getPureLocalStrategy()))
//! MeshDataStrategy Rendering.getDebugStrategy()
ES_FUN(lib,"getDebugStrategy",0,0,
new E_MeshDataStrategy(SimpleMeshDataStrategy::getDebugStrategy()))
//! MeshDataStrategy Rendering.getStaticDrawReleaseLocalStrategy()
ES_FUN(lib,"getStaticDrawReleaseLocalStrategy",0,0,
new E_MeshDataStrategy(SimpleMeshDataStrategy::getStaticDrawReleaseLocalStrategy()))
//! MeshDataStrategy Rendering.getStaticDrawPreserveLocalStrategy()
ES_FUN(lib,"getStaticDrawPreserveLocalStrategy",0,0,
new E_MeshDataStrategy(SimpleMeshDataStrategy::getStaticDrawPreserveLocalStrategy()))
//! MeshDataStrategy Rendering.getDynamicVertexStrategy()
ES_FUN(lib,"getDynamicVertexStrategy",0,0,
new E_MeshDataStrategy(SimpleMeshDataStrategy::getDynamicVertexStrategy()))
//! @}
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
//! @addtogroup rendering_helper
//! @{
//! [ESF] Void Rendering.enableGLErrorChecking()
ES_FUN(lib, "enableGLErrorChecking", 0, 0, (Rendering::enableGLErrorChecking(), EScript::create(nullptr)))
//! [ESF] Void Rendering.disableGLErrorChecking()
ES_FUN(lib, "disableGLErrorChecking", 0, 0, (Rendering::disableGLErrorChecking(), EScript::create(nullptr)))
//! [ESF] Void Rendering.checkGLError()
ES_FUN(lib, "checkGLError", 0, 0, (Rendering::checkGLError(rt.getCurrentFile().c_str(), rt.getCurrentLine()), EScript::create(nullptr)))
//! [ESF] String Rendering.getGLTypeString(Number)
ES_FUN(lib, "getGLTypeString", 1, 1, Rendering::getGLTypeString(parameter[0].to<uint32_t>(rt)))
//! [ESF] Number Rendering.getGLType(TypeConstant)
ES_FUN(lib, "getGLType", 1, 1, Rendering::getGLType(static_cast<Util::TypeConstant>(parameter[0].toUInt())))
//! [ESF] Void Rendering.outputGLInformation()
ES_FUN(lib, "outputGLInformation", 0, 0, (Rendering::outputGLInformation(std::cout), EScript::create(nullptr)))
//! [ESF] Number Rendering.readDepthValue(Number x, Number y)
ES_FUN(lib, "readDepthValue", 2, 2, Rendering::readDepthValue(parameter[0].to<int32_t>(rt), parameter[1].to<int32_t>(rt)))
//! [ESF] Void Rendering.enableDebugOutput()
ES_FUN(lib, "enableDebugOutput", 0, 0, (Rendering::enableDebugOutput(), EScript::create(nullptr)))
//! [ESF] Void Rendering.disableDebugOutput()
ES_FUN(lib, "disableDebugOutput", 0, 0, (Rendering::disableDebugOutput(), EScript::create(nullptr)))
//! [ESF] Void Rendering.clusterPoints(file,count)
ES_FUN(lib, "clusterPoints", 2, 2, (Rendering::Serialization::StreamerXYZ::clusterPoints(Util::FileName(parameter[0].toString()),
parameter[1].to<uint32_t>(rt)),EScript::create(nullptr)))
//! [ESF] void Rendering.startCapture()
ES_FUN(lib, "startCapture", 0, 0, (Rendering::startCapture(), nullptr))
//! [ESF] void Rendering.endCapture()
ES_FUN(lib, "endCapture", 0, 0, (Rendering::endCapture(), nullptr))
//! [ESF] void Rendering.pushDebugGroup(String name)
ES_FUN(lib, "pushDebugGroup", 1, 1, (Rendering::pushDebugGroup(parameter[0].toString()), nullptr))
//! [ESF] void Rendering.popDebugGroup()
ES_FUN(lib, "popDebugGroup", 0, 0, (Rendering::popDebugGroup(), nullptr))
//! [ESF] void Rendering.triggerCapture()
ES_FUN(lib, "triggerCapture", 0, 0, (Rendering::triggerCapture(), nullptr))
//! @}
}
}