Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change mesh's texture? #19

Open
blendogames opened this issue Dec 26, 2016 · 2 comments
Open

Ability to change mesh's texture? #19

blendogames opened this issue Dec 26, 2016 · 2 comments

Comments

@blendogames
Copy link

I was looking for a way to change an SSObjectMesh's texture while the program is running. My attempt at it was:

myObjectMesh.textureMaterial = new SSTextureMaterial (myNewTexture);

However, this doesn't seem to do anything -- I'm guessing I'm misunderstanding how SimpleScene handles this, looking for any suggestions! Thanks.

@jeske
Copy link
Owner

jeske commented Dec 26, 2016 via email

@blendogames
Copy link
Author

Thank you, this clears a lot of things up for me. I'm now able to swap new textures onto my existing mesh objects with the following code.

SSTexture myNewTexture = SSAssetManager.GetInstance<SSTextureWithAlpha>("./newtexture.png");

SSMesh_wfOBJ myInstance = SSAssetManager.GetInstance<SSMesh_wfOBJ>("./modelfile.obj");
myInstance.geometrySubsets[0].textureMaterial = new SSTextureMaterial(myNewTexture);

myMeshObject = new SSObjectMesh(myInstance);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants