Serenity3D Editor API
The Serenity3D editor lets you build 3D scenes visually. This API lets you load those scenes and access their objects from RCBasic code.
Overview
| Function / Sub | Kind | Description |
|---|---|---|
| Serenity_GetSkyShape() | Function | Returns the sky type for the current stage. Possible values: SN_SKY_TYPE_NONE SN_SKY_TYPE_BOX SN_SKY_TYPE_DOME |
| Serenity_GetSkyBox() | Function | Returns the sky box for the current stage. Returns Serenity_Sky_Box |
| Serenity_GetSkyDome() | Function | Returns the sky dome for the current stage. Returns Serenity_Sky_Dome |
| Serenity_StageHasSky() | Function | Returns TRUE if the stage has a sky object and FALSE otherwise. |
| Serenity_GetStageIndex(stage_name$) | Function | Returns the Serenity Stage Index or -1 if the stage name was not found in the project. |
| Serenity_GetStageName$(stage_index) | Function | Returns the name of the stage from the index. |
| Serenity_GetStageCount() | Function | Returns the number of stages in the project. |
| Serenity_ClearStage() | Sub | Clears the currently loaded stage. |
| Serenity_LoadStage(stage_name$) | Sub | Loads a stage. It is a good idea to get the stage index first to make sure the stage exists. |
| Serenity_GetCurrentStageIndex() | Function | Returns the index of the currently loaded stage. |
| Serenity_GetGroupCount() | Function | Returns the number of groups in the current stage. |
| Serenity_GetGroupIndex(group_name$) | Function | Returns the Serenity Group index from the group name or -1 if group does not exist in current stage. |
| Serenity_GetGroupName$(group_index) | Function | Returns the group name. |
Stages
| Function / Sub | Kind | Description |
|---|---|---|
| Serenity_GetStageIndex(stage_name$) | Function | Returns the Serenity Stage Index or -1 if the stage name was not found in the project. |
| Serenity_GetStageName$(stage_index) | Function | Returns the name of the stage from the index. |
| Serenity_GetStageCount() | Function | Returns the number of stages in the project. |
| Serenity_ClearStage() | Sub | Clears the currently loaded stage. |
| Serenity_LoadStage(stage_name$) | Sub | Loads a stage. It is a good idea to get the stage index first to make sure the stage exists. |
| Serenity_GetCurrentStageIndex() | Function | Returns the index of the currently loaded stage. |
Actors
| Function | Description |
|---|---|
| Serenity_GetActorIndex(actor_name$) | Returns the Serenity Actor Index which is used to access actor data in the API. |
| Serenity_GetActorIndexFromStage(stage_actor_index) | This function is used to iterate through all actors in the current stage. It returns -1 when the stage_actor_index exceeds the number of actors in the stage. |
| Serenity_GetActorIndexFromGroup(group_index, group_actor_index) | This function is used to iterate through all actors in a group. It returns -1 when group_actor_index exceeds the number of actors in the group. |
| Serenity_GetActorCount() | Returns the number of actors in the current stage. This count only includes actors that were created in Serenity3D. |
| Serenity_GetActorID(actor_index) | Returns the RCBasic Actor ID. |
| Serenity_GetActorName$(actor_index) | Returns the name of the actor from the given Serenity Actor Index. |
| Serenity_GetActorType(actor_index) | Returns the actor type. Possible values: SN_ACTOR_TYPE_ANIMATED SN_ACTOR_TYPE_OCTREE SN_ACTOR_TYPE_LIGHT SN_ACTOR_TYPE_BILLBOARD SN_ACTOR_TYPE_TERRAIN SN_ACTOR_TYPE_WATER SN_ACTOR_TYPE_PARTICLE SN_ACTOR_TYPE_CUBE SN_ACTOR_TYPE_SPHERE SN_ACTOR_TYPE_PLANE |
| Serenity_GetActorMeshIndex(actor_index) | Returns the Serenity Mesh index the actor was created from. |
| Serenity_GetActorOverrideMaterialIndex(actor_index) | Returns the material index set in an actor's properties on the Stage Editor tab. |
| Serenity_GetActorTerrainHeightMap$(actor_index) | Returns the height map file for a terrain actor. |
| Serenity_GetActorCubeSize(actor_index) | Returns the cube size for a cube actor. |
| Serenity_GetActorSphereRadius(actor_index) | Returns the sphere radius for a sphere actor. |
| Serenity_GetActorGroupIndex(actor_index) | Returns the Serenity Group Index the actor is grouped in or -1 if the actor is not part of a group. |
Groups
| Function | Description |
|---|---|
| Serenity_GetGroupCount() | Returns the number of groups in the current stage. |
| Serenity_GetGroupIndex(group_name$) | Returns the Serenity Group index from the group name or -1 if group does not exist in current stage. |
| Serenity_GetGroupName$(group_index) | Returns the group name. |
Materials
| Function | Description |
|---|---|
| Serenity_GetMaterialIndex(material_name$) | Returns the Serenity Material Index which is used to access material data in the API. |
| Serenity_GetMaterialID(material_index) | Returns the RCBasic material ID or -1 if material_index is not valid. |
| Serenity_GetMaterialTextureIndex(material_index, texture_level) | Returns the Serenity Texture Index which is used to access texture data in the API. |
Meshes
| Function | Description |
|---|---|
| Anim8or | |
| Serenity_GetAN8Count() | Returns the number of Anim8or objects loaded with the current stage. |
| Serenity_GetAN8ID(an8_index) | Returns the RCBasic Anim8or ID. an8_index should be from 0 to Serenity_GetAN8Count()-1 |
| Mesh Properties | |
| Serenity_GetMeshIndex(mesh_name$) | Returns the Serenity Mesh Index which is used to access mesh data in the API. |
| Serenity_GetMeshID(mesh_index) | Returns the RCBasic Mesh ID of the given mesh index or -1 if mesh_index is not valid. |
| Serenity_GetMeshName$(mesh_index) | Returns the mesh name from the given mesh index. |
| Serenity_GetMeshType(mesh_index) | Returns the mesh type. Possible values: SN_MESH_TYPE_NORMAL SN_MESH_TYPE_ZIPPED SN_MESH_TYPE_AN8_SCENE |
| Serenity_GetMeshAN8Index(mesh_index) | Returns the Serenity Anim8or object index. |
| Serenity_GetMeshAN8Scene$(mesh_index) | Returns the scene name in Anim8or that this mesh is loaded from. |
| Serenity_GetMeshArchiveName$(mesh_index) | Returns the name of the archive that the mesh is loaded from. |
| Serenity_GetMeshFile$(mesh_index) | Returns the name of the mesh file that the mesh is loaded from. |
| Mesh Materials & Animations | |
| Serenity_GetMeshMaterialCount(mesh_index) | Returns the number of materials on the given mesh. |
| Serenity_GetMeshMaterialIndex(mesh_index, material_num) | Returns the Serenity Material Index from the material number on the given mesh. |
| Serenity_GetMeshAnimationCount(mesh_index) | Returns the number of animations on the given mesh. |
| Serenity_GetMeshAnimationID(mesh_index, animation_num) | Returns the RCBasic mesh animation ID. |
| Serenity_GetMeshAnimationIDByName(mesh_index, animation_name$) | Returns the RCBasic mesh animation ID by name. |
Textures
| Function | Description |
|---|---|
| Serenity_GetTextureIndex(texture_name$) | Returns the Serenity Texture Index which is used to access texture data in the API. |
| Serenity_GetTextureID(texture_index) | Returns the RCBasic texture ID or -1 if texture_index is not valid. |
| Serenity_GetTextureFile$(texture_index) | Returns the name of the texture file. |
| Serenity_GetTextureColorKey(texture_index) | Returns the color key of the texture. |
| Serenity_GetTextureIsColorKey(texture_index) | Returns TRUE if the texture colorkey flag was set in Serenity3D. |