[][src]Module tray_rust::geometry::instance

Defines an instance of some piece of geometry in the scene, instances can re-use loaded geometry but apply different transformations and materials to them

Scene Usage Example

An instance is an instantion of geometry in your scene. The instance needs to know its type (emitter/receiver), its name along with the geometry to use, material to apply and transformation to place the object in the scene. The instances are specified in the objects list in the scene file.

The transform for the object is specified in the order in which the transformations should be applied. For information on emitters see the emitter documentation.

"objects": [
    {
        "name": "back_wall",
        "type": "receiver",
        "material": "white_wall",
        "geometry": {
            "type": "plane"
        },
        "transform": [
            {
                "type": "scaling",
                "scaling": 15.0
            },
            {
                "type": "translate",
                "translation": [0.0, 1.0, 20]
            }
        ]
    },
    ...
]

Object Group Example

You can also specify groups of objects to have the same transformation applied to all of them. This is done with a 'group' type object followed by a list of objects in the group. For a full example see scenes/cornell_box.json.

"objects": [
    {
        "name": "my_group",
        "type": "group",
        "transform": [
            {
                "type": "translate",
                "translation": [0.0, 1.0, 20]
            }
        ],
        "objects": [
            ...
        ]
    },
    ...
]

Enums

Instance

Defines an instance of some geometry with its own transform and material