|
| | kWorld () |
| | Constructs an empty world and creates its script manager.
|
| virtual | ~kWorld () |
| | Destroys the world, releasing owned scenes, cameras, and managers.
|
| kString | getUuid () |
| | Returns the UUID of this world.
|
| void | setUuid (kString newUuid) |
| | Sets the UUID of this world.
|
| kScene * | createScene (kString sceneName, kString sceneUuid="") |
| | Creates a new scene and registers it in this world.
|
| void | addScene (kScene *scene, kString sceneUuid="") |
| | Registers an existing scene in this world.
|
| kCamera * | addCamera (kVec3 position=kVec3(0.0f, 0.0f, 0.0f), kVec3 lookAt=kVec3(0.0f, 0.0f, 0.0f), kCameraType type=kCameraType::CAMERA_TYPE_FREE, kString objectUuid="") |
| | Creates and registers a camera in this world.
|
| void | addCamera (kCamera *camera, kString objectUuid="") |
| | Registers an existing camera in this world.
|
| kCamera * | getMainCamera () |
| | Returns the camera used by the renderer for the main view.
|
| void | setMainCamera (kCamera *camera) |
| | Sets the main camera used by the renderer.
|
| void | setAssetManager (kAssetManager *manager) |
| | Assigns the asset manager used by scenes in this world.
|
| kAssetManager * | getAssetManager () |
| | Returns the asset manager.
|
| void | removeCamera (kCamera *camera) |
| | Removes a camera from this world's camera list.
|
| void | removeScene (kScene *scene) |
| | Removes a scene from this world's scene list.
|
| std::vector< kScene * > | getScenes () |
| | Returns all scenes registered in this world.
|
| std::vector< kCamera * > | getCameras () |
| | Returns all cameras registered in this world.
|
| kScriptManager * | getScriptManager () |
| | Returns the world's AngelScript manager.
|
| void | startScripts () |
| | Starts script execution across every active scene.
|
| void | stopScripts () |
| | Stops script execution: dispatches OnDestroy() and releases every script instance. Call when gameplay ends.
|
| void | updateScripts (float deltaTime) |
| | Dispatches Update() then LateUpdate() to all running scripts.
|
| void | fixedUpdateScripts (float fixedDeltaTime) |
| | Dispatches FixedUpdate() to all running scripts.
|
| bool | getScriptsRunning () const |
| | Returns true between startScripts() and stopScripts().
|
| void | startPhysics () |
| | Spawns physics bodies and character controllers from every object's editor-authored descriptor, seeded at its current world transform. Call once when gameplay begins.
|
| void | updatePhysics (float deltaTime) |
| | Steps the simulation and syncs transforms back into nodes.
|
| void | stopPhysics () |
| | Destroys all bodies/characters and shuts the simulation down.
|
| bool | getPhysicsRunning () const |
| | Returns true between startPhysics() and stopPhysics().
|
| virtual json | serialize (int startScene=0) |
| | Serialises the world to JSON.
|
| virtual void | deserialize (json data) |
| | Restores the world from a JSON object.
|
| bool | loadFromFile (const kString &path) |
| | Loads a world from a serialized scene.world file, standalone.
|
Root container for the entire simulation environment.
A kWorld owns one or more kScene instances and a camera list. The renderer iterates over active scenes and draws them through the main camera returned by getMainCamera().
Typical setup:
Scene-graph camera node.
Definition kcamera.h:33
Holds all objects, lights, and rendering settings for one scene.
Definition kscene.h:36
kScene * createScene(kString sceneName, kString sceneUuid="")
Creates a new scene and registers it in this world.
void setAssetManager(kAssetManager *manager)
Assigns the asset manager used by scenes in this world.
void setMainCamera(kCamera *camera)
Sets the main camera used by the renderer.
kWorld()
Constructs an empty world and creates its script manager.
kCamera * addCamera(kVec3 position=kVec3(0.0f, 0.0f, 0.0f), kVec3 lookAt=kVec3(0.0f, 0.0f, 0.0f), kCameraType type=kCameraType::CAMERA_TYPE_FREE, kString objectUuid="")
Creates and registers a camera in this world.
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
| bool kemena::kWorld::loadFromFile |
( |
const kString & | path | ) |
|
Loads a world from a serialized scene.world file, standalone.
Reconstructs every scene and object (meshes, lights, cameras, empties) with their transforms and components (physics, character, navigation, scripts), resolving mesh references and script bytecode relative to the file's folder. Designed for a built game running without the editor.
Requires setAssetManager() to have been called first. Picks the first camera found as the main camera.
- Parameters
-
| path | Path to scene.world; asset data is resolved relative to its parent folder (Library/ImportedAssets, Library/Scripts). |
- Returns
- true on success.