6#ifndef KOFFSCREENRENDERER_H
7#define KOFFSCREENRENDERER_H
68 void resize(
int newWidth,
int newHeight);
165 uint32_t colorTex = 0;
166 uint32_t depthRbo = 0;
171 kVec4 bgColor =
kVec4(0.15f, 0.15f, 0.15f, 1.0f);
173 kShader *builtinShader =
nullptr;
178 static constexpr int kMaxShadowCascades = 4;
179 kShader *shadowShader =
nullptr;
180 uint32_t shadowFbo = 0;
181 uint32_t shadowTexArray = 0;
182 int shadowResolution = 1024;
183 int shadowCascadeCount = 3;
184 float shadowSplitLambda = 0.85f;
185 kMat4 lightSpaceMatrices[kMaxShadowCascades];
186 float cascadeSplits[kMaxShadowCascades] = {};
190 void ensureBuiltinShader();
192 void ensureShadowResources();
193 void applyShadowResolution(
int resolution);
199 int sunCount,
int pointCount,
int spotCount);
204 int &outSun,
int &outPoint,
int &outSpot);
205 void setupSingleSunLight(
kShader *shader,
207 void bindMaterialTextures(
kMesh *mesh,
kShader *shader);
208 void unbindMaterialTextures(
kMesh *mesh);
Scene-graph camera node.
Definition kcamera.h:33
Pure-virtual graphics driver interface.
Definition kdriver.h:86
Scene-graph node that holds renderable geometry.
Definition kmesh.h:35
Base scene-graph node.
Definition kobject.h:43
int getWidth() const
Get the output texture width in pixels.
Definition koffscreenrenderer.h:140
int getHeight() const
Get the output texture height in pixels.
Definition koffscreenrenderer.h:146
kOffscreenRenderer(int width=256, int height=256)
Construct the renderer and allocate its offscreen FBO.
~kOffscreenRenderer()
Destroy the renderer and release all GPU resources (FBO, textures, shaders).
bool saveToFile(const kString &filePath) const
Save the current render result to an image file.
void renderMesh(kMesh *mesh, kCamera *camera=nullptr)
Render a single mesh to the offscreen buffer.
void renderMeshWithMaterial(kMesh *mesh, kCamera *camera=nullptr)
Render a mesh using its assigned material shader and uniforms.
uint32_t getTexture() const
GPU texture ID of the current render result.
Definition koffscreenrenderer.h:134
void setBackgroundColor(kVec4 color)
Set the background clear color and alpha (default: opaque dark grey).
Definition koffscreenrenderer.h:78
kVec4 getBackgroundColor() const
Get the current background clear color and alpha.
Definition koffscreenrenderer.h:84
void resize(int newWidth, int newHeight)
Resize the offscreen buffer.
void render(kWorld *world, kScene *scene, kCamera *camera)
Render the full scene to the offscreen buffer.
Holds all objects, lights, and rendering settings for one scene.
Definition kscene.h:36
Wraps a compiled GLSL shader program.
Definition kshader.h:55
Root container for the entire simulation environment.
Definition kworld.h:54
Perspective camera node (free-look or look-at).
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
std::string kString
Standard string alias.
Definition kdatatype.h:42
glm::vec4 kVec4
4-component float vector.
Definition kdatatype.h:34
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
glm::mat4 kMat4
4x4 float matrix.
Definition kdatatype.h:39