A3DGE - Amateur 3D Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers Conclusion
|
Class TWorld3D
Unit
a3dge.World3D
Declaration
type TWorld3D = class(TObject)
Description
The world.
TWorld3D contains all objects, lights and the camera used to render a scene.
See also
- TWorld3D.OwnsObjects
- Should free the objects when they are removed.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
DESTRUCTOR Destroy; OVERRIDE; |
Destructor.
If OwnsObjects is True it will destroy the Objects.
|
 |
PROCEDURE SetFog ( CONST aColor: TColorDescription; CONST aDensity: GLfloat; CONST aHint: GLint = GL_DONT_CARE ); OVERLOAD; |
Defines the fog as exponential (GL_EXP ).
|
 |
PROCEDURE SetFog ( CONST aColor: TColorDescription; CONST aStart, aFinish: GLfloat; CONST aHint: GLint = GL_DONT_CARE ); OVERLOAD; |
Defines the fog as linear (GL_LINEAR ).
Parameters
- aColor
- Fog color.
- aDensity
- Fog density.
- aStart
- Where fog starts.
- aFinish
- Where fog ends.
- aHint
- OpenGL Hint. Can be
GL_NICEST , GL_FASTEST or GL_DONT_CARE . Default is GL_DONT_CARE .
See also
- TWorld3D.UseFog
- Activates or deactivates the fog.
|
 |
PROCEDURE SetOpenGLContext; VIRTUAL; |
Enable OpenGL context, setting lighting, face culling, depth-buffer and 2D textures.
See also
- TWorld3D.DisableOpenGLContext
- Disable OpenGL context.
- TWorld3D.UseFog
- Activates or deactivates the fog.
|
 |
procedure DisableOpenGLContext; |
Disable OpenGL context.
You may need to disable the OpenGL contex when drawing the HUD or other overlays.
Remember to restore the OpenGL context before to render the world.
See also
- TWorld3D.SetOpenGLContext
- Enable OpenGL context, setting lighting, face culling, depth-buffer and 2D textures.
- TWorld3D.UseFog
- Activates or deactivates the fog.
|
 |
PROCEDURE ClearObjects; |
Remove all objects from the list.
It also frees all objects in the list if OwnsObjects is True .
|
 |
FUNCTION AddObject (CONST aObject: TObject3D): INTEGER; |
Adds a new object.
You should not add the same object twice to the list. Note that when OwnsObjects is True this will result in memory corruption when the object is freed (as it will be freed twice). The Add method does not check this, however
Parameters
- aObject
- Reference to the object.
Returns
The object index. See also
- TWorld3D.DeleteObject
- Deletes and frees an object from the list.
- TWorld3D.ExtractObject
- Removes Item from the list, if it is present in the list.
|
 |
PROCEDURE DeleteObject (CONST Ndx: INTEGER); OVERLOAD; |
Deletes and frees an object from the list.
|
 |
FUNCTION ExtractObject (CONST Ndx: INTEGER): TObject3D; OVERLOAD; |
Removes Item from the list, if it is present in the list.
|
 |
FUNCTION ExtractObject (CONST aObject: TObject3D): TObject3D; OVERLOAD; |
Removes Item from the list, if it is present in the list.
Note that the object is not freed, and that only the first found object is removed from the list.
Returns
the object if it is found, Nil if object is not present in the list. See also
- AddObject
- Adds a new object.
- DeleteObject
- Deletes and frees an object from the list.
- ClearObjects
- Remove all objects from the list.
|
 |
PROCEDURE CheckCollisions; |
Check collisions and notify the objects when a collision is detected.
This method will check collisions of objects and the heightmap. The collision is notified using the TObject3D.OnCollision event passing the reference of the other object implied in the collision or Nil if the collision is with the heightmap.
Note it ignores the heigtmap if it isn't visible (i.e. its Visible property is False ). To ignore collisions of objects set their Radius to zero or a negative value. This means it will check collisions of invisible objects too.
See also
- TObject3D.Radius
- Bounding sphere radius.
- TObject3D.UseBoundingBox
- To know if use the Bounding box for colission checking.
- TObject3D.CheckCollision
- Check if object collided with another object.
- TObject3D.OnCollision
- Event to notify collisions.
- TWorld3D.CheckSphereCollision
- Check if the sphere collides with objects in the world.
- TWorld3D.CheckSphereCollisionWithTags
- Check if the sphere collides with objects in the world with given tag.
|
 |
function CheckSphereCollision ( const aCenter: TVector3D; const aRadius: Real; const aId: Integer=0 ): Boolean; |
Check if the sphere collides with objects in the world.
If paramter aId is assinged and it is different to 0, then it will only check objects where its Id is the same value.
Parameters
- aCenter
- Center point coordinates of the sphere.
- aRadius
- Radius of the sphere.
- aId
- Filter objects by its Id.
See also
- TWorld3D.CheckCollisions
- Check collisions and notify the objects when a collision is detected.
- TWorld3D.CheckSphereCollisionWithTags
- Check if the sphere collides with objects in the world with given tag.
- TObject3D.Id
- Object identifier.
|
 |
function CheckSphereCollisionWithTags ( const aCenter: TVector3D; const aRadius: Real; const aTag: Integer; const aAnd: Boolean=False ): Boolean; |
Check if the sphere collides with objects in the world with given tag.
This will check collisions with objects which its Tag property is the same that the value pased as aTag parameter.
If aAnd parameter is assigned to True , then both tags will be combined using the AND operator and only those that retun a value different than 0 (zero) will be checked.
Parameters
- aCenter
- Center point coordinates of the sphere.
- aRadius
- Radius of the sphere.
- aTag
- The tag of the objects to check with.
- aAnd
- If
True , it will use operator AND , if False , it will use operator = (equals).
See also
- TWorld3D.CheckCollisions
- Check collisions and notify the objects when a collision is detected.
- TWorld3D.CheckSphereCollision
- Check if the sphere collides with objects in the world.
- TEntity3D.Tag
- A tag value.
|
Properties
 |
property Size: GLfloat READ fSize; |
Universe size.
Size is the size of the Octree's root node.
This is just informative and it doesn't have any effect in behavior of the game.
|
 |
property RenderBounding: BOOLEAN READ fDrawBounding WRITE fDrawBounding; |
If True it renders bounding boxes and/or spheres too.
|
 |
property OwnsCamera: Boolean read fOwnsCamera write fOwnsCamera; |
Should free the Camera when removed.
If you're using various cameras, this should be False .
Default is True .
|
 |
property OwnsSkybox: Boolean read fOwnsSkybox write fOwnsCamera; |
Should free the SkyBox when removed.
Default is True .
|
 |
property Skybox: TModel3D READ fSkyBox WRITE SetSkybox; |
The skybox.
If you don't use skybox just assign Nil .
See also
- TWorld3D.OwnsSkybox
- Should free the SkyBox when removed.
|
 |
property Lights[Ndx:INTEGER]: TLight READ GetLight; |
List of lights.
By default, all lights are disabled.
|
 |
property UseFog: BOOLEAN READ fUseFog WRITE fUseFog; |
Activates or deactivates the fog.
See also
- SetFog
- Defines the fog as linear (
GL_LINEAR ).
|
 |
property Heightmap: THeightmap read fHeightmap; |
Heightmap.
|
 |
property OwnsObjects: Boolean read GetOwnsObjects write SetOwnsObjects; |
Should free the objects when they are removed.
|
 |
property NumObjects: INTEGER READ GetNumObjects; |
The number of elements in the list. Note that this includes Nil elements.
|
 |
property Objects[Ndx:INTEGER]: TObject3D READ GetObject WRITE SetObject; |
Indexed access to the elements in the list.
The index Ndx is zero based, i.e., runs from 0 (zero) to NumObjects - 1 .
See also
- AddObject
- Adds a new object.
- TWorld3D.OwnsObjects
- Should free the objects when they are removed.
|
 |
property Octree: TOctree READ fOctree; |
Access to octree.
You can use this method to change the octree properties such as size and Depth.
|
Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.
|