189 kLight *
addSunLight(
kVec3 position =
kVec3(0.0f, 0.0f, 0.0f),
kVec3 direction =
kVec3(0.0f, -1.0f, 0.0f),
kVec3 diffuseColor =
kVec3(1.0f, 1.0f, 1.0f),
kVec3 specularColor =
kVec3(1.0f, 1.0f, 1.0f),
kString objectUuid =
"");
349 bool isActive =
true;
350 bool frustumCullingEnabled =
true;
355 std::vector<kObject *> objects;
356 std::vector<kMesh *> meshes;
357 std::vector<kLight *> lights;
361 kVec3 ambientLightColor =
kVec3(0.1f, 0.1f, 0.1f);
363 bool shadowsEnabled =
true;
364 float shadowBias = 0.0008f;
365 float shadowNormalBias = 0.003f;
366 int shadowMapResolution = 2048;
367 float shadowSoftness = 1.5f;
368 bool skyboxAmbientEnabled =
false;
369 float skyboxAmbientStrength = 1.0f;
372 kMesh *skyMesh =
nullptr;
Central asset-loading and cache manager.
Definition kassetmanager.h:55
Scene-graph node that emits light.
Definition klight.h:28
Groups a shader program with textures and surface parameters.
Definition kmaterial.h:27
Scene-graph node that holds renderable geometry.
Definition kmesh.h:35
Base scene-graph node.
Definition kobject.h:43
std::vector< kObject * > getObjects()
Returns all generic scene-graph objects.
bool getShadowsEnabled() const
Returns whether the scene wants shadow rendering.
void removeMesh(kMesh *mesh)
Removes a mesh node from the scene graph.
void setSkybox(kMaterial *newMaterial, kMesh *newMesh)
Sets the skybox material and mesh.
kScene()
Constructs an empty scene with a default root node.
void setIncrement(unsigned int newIncrement)
Sets the auto-increment counter (used when deserialising).
kMesh * addMesh(kString fileName, kString objectUuid="")
Loads a mesh asset and adds it to the scene.
void setShadowMapResolution(int resolution)
Sets the per-cascade shadow map resolution (e.g. 512, 1024, 2048, 4096). Reallocates the shadow textu...
void setActive(bool newActive)
Activates or deactivates this scene.
kMesh * getSkyboxMesh()
Returns the skybox mesh.
float getShadowSoftness() const
Returns the PCF tap spacing (in shadow-map texels).
kMaterial * getSkyboxMaterial()
Returns the skybox material.
void addMesh(kMesh *mesh, kString objectUuid="")
Adds an existing mesh node to the scene graph.
kString getUuid()
Returns the UUID of this scene.
float getShadowNormalBias() const
Returns the slope-scaled component of the shadow bias.
void removeObject(kObject *object)
Removes a generic object from the scene graph.
void setName(kString newName)
Sets the human-readable scene name.
void setAssetManager(kAssetManager *manager)
Sets the asset manager used to load resources into this scene.
void setShadowsEnabled(bool enabled)
Toggles shadow rendering for this scene.
void setShadowSoftness(float softness)
Sets the PCF tap spacing in shadow-map texels. Larger = softer edges but more bleeding of small occlu...
void setShadowNormalBias(float bias)
Sets the slope-scaled component of the shadow bias. Multiplied by (1 - N·L); only affects grazing-ang...
virtual void deserialize(json data)
Restores the scene from a JSON object.
int getShadowMapResolution() const
Returns the per-cascade shadow map resolution in pixels.
std::vector< kLight * > getLights()
Returns all light nodes in the scene.
kLight * addPointLight(kVec3 position=kVec3(0.0f, 0.0f, 0.0f), kVec3 diffuseColor=kVec3(1.0f, 1.0f, 1.0f), kVec3 specularColor=kVec3(1.0f, 1.0f, 1.0f), kString objectUuid="")
Creates and adds an omnidirectional point light.
void setSkyboxAmbientEnabled(bool enabled)
Enables or disables skybox image-based ambient lighting.
unsigned int getIncrement()
Returns the auto-increment counter used to assign object IDs.
kLight * addSunLight(kVec3 position=kVec3(0.0f, 0.0f, 0.0f), kVec3 direction=kVec3(0.0f, -1.0f, 0.0f), kVec3 diffuseColor=kVec3(1.0f, 1.0f, 1.0f), kVec3 specularColor=kVec3(1.0f, 1.0f, 1.0f), kString objectUuid="")
Creates and adds a directional (sun) light.
kLight * addSpotLight(kVec3 position=kVec3(0.0f, 0.0f, 0.0f), kVec3 diffuseColor=kVec3(1.0f, 1.0f, 1.0f), kVec3 specularColor=kVec3(1.0f, 1.0f, 1.0f), kString objectUuid="")
Creates and adds a cone spotlight.
bool getActive()
Returns whether this scene is active (rendered and updated).
void addLight(kLight *light)
Re-attaches an existing light to the scene (used for undo).
kString getName()
Returns the human-readable scene name.
void setSkyboxAmbientStrength(float strength)
Sets the skybox ambient strength multiplier.
void removeLight(kLight *light)
Removes a light node from the scene graph and the light list.
void setShadowBias(float bias)
Sets the constant shadow bias used by lit shaders. Larger values reduce acne but can detach the shado...
void addObject(kObject *object, kString objectUuid="")
Adds a generic object to the scene graph.
kObject * getRootNode()
Returns the root node of the scene graph.
void setUuid(kString newUuid)
Sets the UUID of this scene.
virtual ~kScene()
Destroys the scene. Does not free objects/meshes/lights held by pointer.
float getShadowBias() const
Returns the constant shadow bias used by lit shaders.
void setAmbientLightColor(kVec3 newColor)
Sets the scene-level ambient light colour.
virtual json serialize()
Serialises the scene to JSON.
void setWorld(kWorld *newWorld)
Associates this scene with a parent world.
bool getFrustumCullingEnabled() const
Returns whether frustum culling is enabled for this scene.
Definition kscene.h:84
void setFrustumCullingEnabled(bool enable)
Enable or disable frustum culling for this scene (default: enabled).
Definition kscene.h:81
kAssetManager * getAssetManager()
Returns the asset manager associated with this scene.
float getSkyboxAmbientStrength()
Returns the skybox ambient strength multiplier.
std::vector< kMesh * > getMeshes()
Returns all mesh nodes in the scene.
bool getSkyboxAmbientEnabled()
Returns whether skybox image-based ambient is enabled.
kVec3 getAmbientLightColor()
Returns the scene-level ambient light colour.
kWorld * getWorld()
Returns the parent world.
Root container for the entire simulation environment.
Definition kworld.h:54
Loads and manages textures, meshes, shaders, materials, and animations.
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
Light source scene-graph node (point, directional, spotlight).
Polygonal mesh node with skeletal animation support.
Base class for all scene-graph nodes in the Kemena3D engine.
nlohmann::json json
Definition kobject.h:30
Top-level container holding scenes and cameras.
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
std::string kString
Standard string alias.
Definition kdatatype.h:42
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33