Game Development Community

CustomMaterial vs Material

by Jeremiah Fulbright · in Torque Game Engine Advanced · 03/30/2006 (1:53 am) · 1 replies

I am working on some rendering with a custom shader, so we're using a CustomMaterial for the texture definition. This is actually working great, but I've decided I'd like to allow anything Material to be able to mapped to my object, obviously not using a custom shader for this point.

Previously, I was doing a static cast to CustomMaterial and finding the name of the texture, etc.. I saw the code used for Interiors which do a dynamic cast to Material and then I create a new MatInstance later on.. At which point I call MatInstance->setupPass (sgData), and debugging it shows it going thru the proper calls and seems to be doing what it should.. but I'm not seeing anything rendered.

Is there a proper way to reference both Material and CustomMaterial, such as do I need to even be doing MatInstance, or can I just do Material->setupPass(sgData)?

Thanks!

#1
03/31/2006 (7:55 pm)
As an extension to this, I've added isCustomMaterial() to Material and CustomMaterial classes, so I can easily determine which class I'm working with at a certain point.

I was attempting to do a cast to CustomMaterial and then just make sure it was in fact that, but it wasn't working so well.. so now its alot easier to just do mMat->isCustomMaterial(), as needed..

It'd be nice if something along those lines was added in by GG officially, as it simplifies the process of using only CustomMaterials or what have you