-
Notifications
You must be signed in to change notification settings - Fork 1
Resource
A lot of data can be used in different places without the need to create copies of it, but just by referencing. For example, a cube may appear in a scene a hundred times, but there is no need to feed the data for all these cubes into the rendering system. It's enough to refer to the data of one cube and render this cube a hundred times in different places. Even if the cubes should be of different sizes or unequally scaled in their dimensions, using transformations during the rendering process will display them as desired. The term resource in FUDGE refers to this type of data.
Using components, standard resources like meshes, materials and sounds are tied to nodes.
It is often desirable to reuse a node with a complex setup or even a whole branch in different locations of a scene. This can be achieved by registering it to FUDGE as a Graph. When instantiating a Graph, FUDGE copies the resource but the copy keeps a reference to the original. When mutating the copy, the graph mutates accordingly and so do again all other instances. This applies only when using the mutation system. Direct manipulations are not transferred.
FUDGE automatically creates an id for each resource, which carries human readable information like the type of the resource and the time created. Instances of the resources refer to their source via this id. This way, changes to the resource can be transferred to the instance at runtime and vice versa. This feature is not implemented yet as of 12/2021.
FUDGE makes use of TypeScript namespaces. Defining resources via script in a namespace, requires FudgeCore to know that namespace. Register it to the Serializer.