Jump to content

[SOLVED] Image decals in C++ API


photo

Recommended Posts

I'd like to be able to load an image (at runtime) and create a deferred projected decal from it. Can anyone point me to a code snippet/example for doing this using the C++ API? My understanding is that I will need to load the image, create a material from the image, create a decal, then assign the image material to the decal. 

 

Thanks,

Kevin

 

 

Link to comment
The following code seems to work:



Unigine::Materials::get()->load("samples/decals/common/decals.mat");
Unigine::DecalDeferredProj decal = Unigine::DecalDeferredProj::create(100.f, 45.f, 1.f, "decal_deferred_base");
Unigine::MaterialPtr decalMaterial = decal->getMaterial();
Unigine::ImagePtr diffuseImg = Unigine::Image::create();
diffuseImg->load("image.png");
decalMaterial->setImageTextureImage(decalMaterial->findTexture("diffuse"), diffuseImg);

Link to comment
×
×
  • Create New...