kevin Posted June 19, 2015 Share Posted June 19, 2015 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
kevin Posted June 21, 2015 Author Share Posted June 21, 2015 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
Recommended Posts