- Home /
Question by
Theacesofspades · May 26, 2016 at 10:34 PM ·
textureuvvoxel
Voxel texturing with single texture instead of texturesheet?
I have a voxel world that is pulling textures from a texturesheet which is placed on the chunk object. However is there a way to texture the chunk objects using a single texture instead of a texturesheet?
I have this class:
public class AllBlocks
{
public string name;
public Vector2 texturePosition;
}
and I want to be able to have this:
public class AllBlocks
{
public string name;
public Texture myTexture;
}
is there any way to change this class in order to use a single texture and not a tilesheet? :
void TextureCube (Vector2 texturePosition)
{
newUV.Add(new Vector2 (tUnit * texturePosition.x + tUnit, tUnit * texturePosition.y));
newUV.Add(new Vector2 (tUnit * texturePosition.x + tUnit, tUnit * texturePosition.y + tUnit));
newUV.Add(new Vector2 (tUnit * texturePosition.x, tUnit * texturePosition.y + tUnit));
newUV.Add(new Vector2 (tUnit * texturePosition.x, tUnit * texturePosition.y));
}
Is there something along these lines that I can do? :
void TextureCube (Texture myTexture)
{
newUV.Add(myTexture);
newUV.Add(myTexture);
newUV.Add(myTexture);
newUV.Add(myTexture);
}
This is the best I can explain what I am trying to do. Is there anyone that can help me with this? Thank you
Comment