Jump to content

How to assign texture info to NodePtr


photo

Recommended Posts

Posted (edited)

From the sample code , we can assign a texture to material then apply to mesh object.

My Node info is :

image.thumb.png.2346226f99d400a1e1c02e89951ea198.png

I want to assign a texture to material then apply on Static mesh .

 

				ObjectMeshStaticPtr mesh= ObjectMeshStatic::cast(myTempNode);
				if (mesh)
				{				
					MaterialPtr material = mesh->getMaterialInherit(0);
					int num = material->findTexture("albedo"); //diffuse
					if (num != -1)
					{
						ImagePtr myImage = Unigine::Image::create(importImage);
						material->setTextureImage(num, myImage);
					}
				}

 

But the mesh object is always null. 

How can I get the mesh object correctly ?

Thanks for any advice .

@silent @bmyagkov Really need your help.

 

Edited by leon.dong
Link to comment
×
×
  • Create New...