Jump to content

Recommended Posts

Posted (edited)

I'm trying to figure out how to apply selected textures to a mesh for rendering. The textures are selected from other objects, so not known in advance, but they are game assets, not custom (yet). I have no problem grabbing the texture IDs and can get the asset locations, too. My entity renders without issue as well. I'm just unable to figure out how to create or modify the ITexPositionSource object being fed into TesselateShape().

I've tried using Tesselator.GetTextureSource(sourceBlock) and new ShapeTextureSource(capi, shape, "shape") where shape is the shape I'm tessellating and I've modified the Textures attribute with the desired AssetLocations.

Is there a different, better way to do this? Do I need to perform some additional operation, like perhaps call a method on the texture source object to load or parse the textures?

EDIT: I also wanted to ask if maybe I'm using the wrong method for tessellating? It seems odd that the texture information is in the shape object, yet TesselateShape() wants a separate texture source object in addition to the shape object itself.

Oh, and here's basically what I have:

                    modTexSource = new ShapeTextureSource(capi, modShape, "ModTexSource");
                    capi.Tesselator.TesselateShape("modEntity", modShape, out modMesh, modTexSource);
        	        modMeshRef = capi.Render.UploadMesh(modMesh);
					capi.Render.RenderMesh(modMeshRef);

 

Edited by Uriel Cain
Weird formatting
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.