24 #include <flw/Config.h> 26 #include <flw/flf/management/TextureSystem.h> 28 #include <flw/cmn/Aliases.h> 30 #include <flw/flf/space/Scene.h> 32 #include <flw/cmn/Macros.h> 34 #include <flw/flf/actions/Event.h> 36 #include <flw/flf/space/LightPoint.h> 37 #include <flw/flf/space/LightSpot.h> 38 #include <flw/flf/space/LightDirectional.h> 39 #include <flw/flf/hud/Text.h> 41 #include <flw/flf/actions/EventHandler.h> 43 #include <flw/cmn/resources/FileLoader.h> 44 #include <flw/flf/loaders/ModelLoader.h> 45 #include <flw/flf/loaders/ProgramLoader.h> 47 #include <flw/flf/management/CacheBuffer.h> 48 #include <flw/flf/management/CacheProgram.h> 49 #include <flw/flf/management/Cachehader.h> 50 #include <flw/flf/management/CacheSampler.h> 52 #include <flw/flf/management/LightSystem.h> 54 #include <flw/flf/models/MeshOcclusion.h> 56 #include <flw/flc/operations/PostProcessingPass.h> 58 #include <flw/Debugger.h> 60 #if defined(FILLWAVE_BACKEND_OPENGL_ES_20) 62 #include <flw/flc/extended/buffers/PixelBuffer.h> 63 #include <flw/flc/extended/pipeline/Fence.h> 72 struct VertexParticleGPU;
73 struct VertexPosition;
75 class VertexBufferParticles;
76 class VertexBufferParticlesGPU;
77 class VertexBufferFloat;
78 class VertexBufferPosition;
87 Engine(
const std::string& runtimeBinaryFilePath,
bool isEveryExtensionSuccessfullyLoaded);
92 void configDebugger(EDebuggerState state);
93 void configFileLogging(std::string fileName =
"");
94 void configFPSCounter(std::string fontName =
"", glm::vec2 position = glm::vec2(-0.95, 0.95), GLfloat size = 100.0);
95 void configBackgroundColor(glm::vec3 color);
96 void configTime(GLfloat timeFactor);
106 void detach(ps<flf::Text> text);
115 const std::string getGlobalPath(
const std::string& localPath);
118 void setCurrentScene(pu<flf::Scene> &&scene);
119 pn<flf::Scene> getCurrentScene()
const;
122 GLuint getAndResetRenderedFramesCount();
124 template <GLu
int T>
flc::Shader* storeShader(
const std::string& shaderPath);
125 template <GLu
int T>
flc::Shader* storeShader(
const std::string& shaderPath,
const std::string& shaderSource);
126 flc::Program* storeProgram(
const std::string &name,
const vec<flc::Shader *> &shaders,
bool isSkipLinking =
false);
136 flf::LightSpot* storeLightSpot(glm::vec3 pos, glm::quat rot, glm::vec4 col,
Moveable *followed =
nullptr);
141 ps<flf::Text> storeText(
142 const std::string &text
143 ,
const std::string &font
145 , GLfloat scale = 1.0f
146 , glm::vec4 color = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)
147 , ETextEffect effect = ETextEffect::none);
153 template <
class T,
typename ...S>
155 return storeBufferInternal(vao, p...);
159 template <
class T,
typename ...S>
161 return storeBuffersInternal(vao, idx, p...);
172 void captureFramebufferToFile(
const std::string &name);
173 void captureFramebufferToBuffer(GLubyte *buf, GLint *sizeInBytes, GLuint format = GL_RGBA, GLint bytesPerPixel = 4);
180 glm::ivec2 getScreenSize()
const;
181 GLfloat getScreenAspectRatio()
const;
187 void addPostProcess(
const std::string &fragmentShaderPath, GLfloat lifeTime = flf::FILLWAVE_ENDLESS);
192 GLuint mWindowHeight;
193 GLfloat mWindowAspectRatio;
203 #if defined(FILLWAVE_BACKEND_OPENGL_ES_20) 205 pu<flc::PixelBuffer> mPickingPixelBuffer;
211 #if defined(FILLWAVE_BACKEND_OPENGL_ES_20) 216 pu<flf::TextureSystem> mTextures;
217 pu<flf::LightSystem> mLights;
218 vec<flc::PostProcessingPass> mPostProcessingPasses;
220 vec<ps<Font>> mFontManager;
221 vec<ps<flf::Text>> mTextManager;
223 #if defined(FILLWAVE_BACKEND_OPENGL_ES_20) 225 pu<flc::Fence> mFence;
229 pu<flf::MeshOcclusion> mOcclusion;
232 vec<flf::EventHandler> mHandlers;
234 pu<flf::Scene> mScene;
237 pu<flf::Debugger> mDebugger;
238 GLuint mFrameCounter;
240 ps<flf::Text> mFPSText;
244 glm::vec3 mBackgroundColor;
248 void onResizeScreen(GLuint width, GLuint height);
249 void onPick(GLuint xScreenSpace, GLuint yScreenSpace);
250 void attachHandler(std::function<
void(
const flf::Event&)>&& h, flf::EEventType type);
251 void detachHandlers();
257 #if defined(FILLWAVE_BACKEND_OPENGL_ES_20) 261 const std::string &posX
262 ,
const std::string &negX
263 ,
const std::string &posY
264 ,
const std::string &negY
265 ,
const std::string &posZ
266 ,
const std::string &negZ);
271 void initPickingBuffer();
274 void initPipelines();
276 void initManagement();
278 void initOcclusionTest();
280 void populateLights();
281 void populateDebugger();
282 void populateDynamicTextures(GLfloat timeExpiredInSeconds);
285 void drawOcclusionPass();
290 void drawSceneStartup();
292 void updatePostprocessing(GLfloat time);
293 void drawSceneCore();
298 , std::function<
float(
float x,
float y)> constructor
301 , vec<GLuint> &indices);
306 , vec<flc::VertexBasic> &data);
311 ,
const vec<GLfloat> &data
312 ,
const vec<GLfloat> &coords);
315 storeBuffersInternal(
318 , vec<flc::VertexParticleGPU> &particles);
325 , vec<GLfloat> &tim);
329 ,
const ModelLoader::ShapeType* shape
330 , ModelLoader::Animator* animator);
341 glm::ivec4 pickingBufferGetColor(GLubyte* data, GLuint x, GLuint y);
342 void reloadPickingBuffer();
Encapsulates reloadable objects.
Definition: IReloadable.h:35
Manager to handle TextureObject1D, TextureObject2D and TextureObject3D objects.
Definition: TextureSystem.h:38
Light implementing directional torch.
Definition: LightSpot.h:34
Single GLSL 2D Texture object.
Definition: Texture2D.h:36
Loads programs.
Definition: ProgramLoader.h:37
Vertex buffer specialized with VertexText data structure.
Definition: mVertexBufferText.h:42
Vertex buffer specialized with VertexParticle data structure.
Definition: mVertexBufferParticles.h:43
Not used. Vertex buffer specialized with VertexPosition data structure.
Definition: mVertexBufferPosition.h:41
Fillwave engine core.
Definition: Engine.h:85
Base for all Scene nodes.
Definition: Entity.h:48
Event.
Definition: Event.h:154
Dynamic texture will update its content during runtime according to specified fragment shader...
Definition: Texture2DRenderableDynamic.h:34
SamplerObject - SO.
Definition: Sampler.h:33
Basic manager of composites.
Definition: TCache.h:44
Loads files.
Definition: FileLoader.h:34
Vertex buffer specialized with VertexParticleGPU data structure.
Definition: VertexBufferParticlesGPU.h:49
VertexArrayObject - VAO.
Definition: VertexArray.h:33
IndexBufferObject - IBO.
Definition: IndexBuffer.h:35
Light with Orthographic projection.
Definition: LightDirectional.h:42
Physical mesh data.
Definition: PhysicsMeshBuffer.h:33
Base for every object which has a 3D position.
Definition: Moveable.h:43
Light system knows about all light related stuff.
Definition: LightSystem.h:40
Single GLSL 3D Texture object. It consists of six 2D images.
Definition: Texture3D.h:34
Loads fonts fromttf files.
Definition: FontLoader.h:33
Vertex buffer specialized with VertexDebug data structure.
Definition: mVertexBufferDebug.h:42
Single GLSL program object.
Definition: Program.h:37
Single GLSL shader object.
Definition: Shader.h:44
Vertex buffer specialized with VertexBasic data structure.
Definition: mVertexBufferBasic.h:61
Not used.
Definition: LightPoint.h:37
Connects VAO pointer and VAO's user pointer in single class.
Definition: CacheBuffer.h:39
One can render to this texture and use the rendered image as a 2D texture.
Definition: Texture2DRenderable.h:34
Vertex buffer specialized with GLfloat data structure.
Definition: mVertexBufferFloat.h:41