new = singleton
by Steve Acaster · in Torque 3D Professional · 10/14/2009 (7:39 pm) · 5 replies
I noticed that (eg - some materials) "new material" has changed to "singleton material", though "new" still works fine. Is this just to keep everything "nice and tidy"? Does the use of "singleton" over "new" enable more options in the background?
Just curious, that's all.
Just curious, that's all.
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#2
Let's say you have the following:
If you were to perform another new ShaderData(SSAOShader), the second one will fail to create. Now, if you are using singletons, it's a different story. If you create a second singleton ShaderData(SSAOShader), the properties of the second object will update/override the original.
10/14/2009 (8:38 pm)
@Steve - Brief Singleton Syntax.Let's say you have the following:
new ShaderData( SSAOShader )
{
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "shaders/common/postFx/ssao/SSAO_P.hlsl";
pixVersion = 3.0;
};If you were to perform another new ShaderData(SSAOShader), the second one will fail to create. Now, if you are using singletons, it's a different story. If you create a second singleton ShaderData(SSAOShader), the properties of the second object will update/override the original.
#4
10/14/2009 (10:36 pm)
@Orion - I know it did not fully support what the singleton keyword can do. It may have completely overridden instead of just updating.
#5
in TGE, if you issued a second New with the same object name,
it created a new object and assigned the global name to it.
so both objects would report their name the same, and answer to the same namespace, but referencing the global name would reference the latter.
this was sometimes hell and sometimes convenient.
interesting, this new stuff. ;)
10/15/2009 (3:59 am)
yes.. it does seem different.in TGE, if you issued a second New with the same object name,
it created a new object and assigned the global name to it.
so both objects would report their name the same, and answer to the same namespace, but referencing the global name would reference the latter.
this was sometimes hell and sometimes convenient.
interesting, this new stuff. ;)
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft