Skip to content

pascal3d_base

This package extends p3d.plot with a scene graph and basic structures like meshes, materials or lights.

Different types of data blocks

A Pascal3D library is organized in data blocks similar to Blender. These comprise meshes, materials, lights or scenes and belong to exactly one entity called a library. This library contains slots for all different kind of data blocks.

Scene graph and objects

While these data blocks can be used on their own these are typically used with scenes. A scene contains one ore more objects. The Data property determines the nature of the object (A mesh, camera or lamp) and is a link to another data block in the same library or another library. The Transform property holds information about location, rotation and scale of the object. This way the spatial representation in the scene is separated from the actual data and makes it possible to reuse eg. meshes without making a copy of them and take up more space in memory (Instancing). While the different kind of data can be used by many objects each object should be used by exactly one scene only. It is however possible to set the data property to reference other scenes and move them in space. For example the world can be a scene and the player can be another scene that moves in the first scene. Objects can have one or more child objects that are transformed together with their parent object.

Saving and loading game data

A Pascal3D library can be saved to or loaded from a json file (.p3d). This file is meant to be human readable to make it possible to get a quick overview and to be able to make minor adjustments. As some structures as meshes contain a high amount of data and thus reduce the readibility their data is stored in an extra binary with the same name but with a different extension (.p3dbin). This also lowers file size and loading time. The file is referenced to with an offset by the json file and is useless without it, so whatever you change in the json file, do not edit this information unless you know what you are doing.

While you can make manual changes to the files in most cases you may want to use the P3DScene editor or use the Blender exporter script to generate or modify them.