Previous | Up

APPENDIX A

LfSceneProxy Implementations



LfLocalSceneProxy

include files:
Lightflow/LfLocalSceneProxy.h

This class does not need any particular documentation, since it is a direct implementation of the Lightflow Rendering Interface.
This means that every action performed using this proxy is directly executed in the same process and without any delay.
For example, this class may be useful to develop plugins that perform rendering into modeling packages, CAD systems or animation softwares.
The only particular that is important to note is the prototype of the constructor.

LfLocalSceneProxy(LfInt texturememory = 10 * 1024)

In fact, this allows to set the amount of memory used to cache textures (in Kb). Obviously, more memory means lower rendering times, particularly when the amount of textures is huge.


LfASCIISceneProxy

include files:
Lightflow/LfASCIISceneProxy.h
Lightflow/LfASCIIServer.h

related files:
Lightflow/LfIOStream.h
Lightflow/LfStdIO.h

This class is a proxy in the real sense, i.e. it does not perform any scene management operation directly. Instead it redirects all the data flow into ASCII streams that can be reinterpreted with a specific function.
The constructor of this class needs a pointer to a LfOAStream object, that is to say an Abstract Output ASCII Stream. This type is abstract, in the sense that none of its methods really perform anything. In order to obtain some results, one should use an inherited type. For example, if you want to redirect the output to a file, you could simply use a LfFileIOAStream object, while if you want to see it in your console, you could use a LfConsoleOAStream.
To interpret the file you may use one of the following functions:

      void LfASCIIServer(LfIAStream* stream, LfBool perform = LfTrue);
      void LfASCIIServer(LfIAStream* stream, LfSceneProxy* scene);

The first procedure scans the Input ASCII Stream which is passed to it and interprets it. If perform is set to LfTrue, then the function really executes the scene commands encountered while interpreting, as if the scene was created using a LfLocalSceneProxy, otherwise it only scans tokens.
The second procedure is a generalization of the first, in the sense that it allows to use a secondary scene proxy to perform interpreted actions. This is very useful, for example to make a translator that converts an ASCII file to a binary one.
Note that the scene proxy is not cleaned in any way after having read a scene. If it were a LfLocalSceneProxy it could not be reused a second time.

Here it is important for the user of this proxy to note that a file may contain a certain number of scenes, which may constitute an animation. This is the reason why it is possible to set perform to LfFalse, since one may want to load only a subsequence of the entire set of frames.
Anyway, the user should note that the proxy only stores a single scene block, it has no cognition of the whole animation. So one presumably has to type the length of the anim at the beginning of the stream, so that the interpreter program may know it before loading. For compatibility reasons a standard file format is suggested: in this way any file could be read by any server, independently of the program that created it.
The suggested file extension is ".lfa", while the format is the following:

"Header" a keyword written in standard ASCII form
header a series of lines, which may contain any private data
"Body" a keyword written in standard ASCII form
number of frames written in standard decimal ASCII form
exported scenes written with the LfASCIISceneProxy
private data ---


LfBinarySceneProxy

include files:
Lightflow/LfBinarySceneProxy.h
Lightflow/LfBinaryServer.h

related files:
Lightflow/LfIOStream.h
Lightflow/LfStdIO.h

This class is a proxy in the real sense, i.e. it does not perform any scene management operation directly. Instead it redirects all the data flow into binary streams that can be reinterpreted with a specific function.
The constructor of this class needs a pointer to a LfOBStream object, that is to say an Abstract Output Binary Stream. This type is abstract, in the sense that none of its methods really perform anything. In order to obtain some results, one should use an inherited type. For example, if you want to redirect the output to a file, you could simply use a LfFileIOBStream object.
To interpret the file you may use one of the following functions:

      void LfBinaryServer(LfIBStream* stream, LfBool perform = LfTrue);
      void LfBinaryServer(LfIBStream* stream, LfSceneProxy* scene);

The first procedure scans the Input Binary Stream which is passed to it and interprets it. If perform is set to LfTrue, then the function really executes the scene commands encountered while interpreting, as if the scene was created using a LfLocalSceneProxy, otherwise it only scans tokens.
The second procedure is a generalization of the first, in the sense that it allows to use a secondary scene proxy to perform interpreted actions. This is very useful, for example to make a translator that converts a binary file to an ASCII one.
Note that the scene proxy is not cleaned in any way after having read a scene. If it were a LfLocalSceneProxy it could not be reused a second time.

Here it is important for the user of this proxy to note that a file may contain a certain number of scenes, which may constitute an animation. This is the reason why it is possible to set perform to LfFalse, since one may want to load only a subsequence of the entire set of frames.
Anyway, the user should note that the proxy only stores a single scene block, it has no cognition of the whole animation. So one presumably has to type the length of the anim at the beginning of the stream, so that the interpreter program may know it before loading. For compatibility reasons a standard file format is suggested: in this way any file could be read by any server, independently of the program that created it.
The suggested file extension is ".lfb", while the format is the following:

header length expressed as a long integer
header a series of bytes
number of frames expressed as a long integer
exported scenes written with the LfBinarySceneProxy
private data ---