ScaleTexture probably
Edit: Oh I see you problem now, I've made a thing that creates 5 sided cubes with the same texture on each side, didn't know it could give anyone that big of a problem though lol.
Here's is code I'm using in my Gorilla game, the back of the cube has no face on it because it's a side scrolling game so I didn't need it. I also had to scale the texture by .5 on the Y axis to fit because of the way I set up the cube creation. The textures I'm using in my game are 512,1024 so I had to set the cubes so the fit a certain of the texture. Feel free to change it.
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
Global Light = CreateLight()
Global elementtexture=LoadTexture("elementtexture.png",8)
ScaleTexture elementtexture,1,.5
Global Camera = CreateCamera()
PositionEntity Camera,0,0,-5
Global Ground = CreatePlane()
PositionEntity Ground,0,-2,0
Local Piece.TYPE_Ground = FUNC_Create_Ground(0,0,0)
While Not KeyDown(1)
TurnEntity Piece\E_Point,.25,.5,0
UpdateWorld
RenderWorld
Flip
Wend
End
Type TYPE_Ground
Field E_Point%,E_Texture%
Field F_X#,F_Y#,F_Z#
Field I_AngledMdl%
Field I_Turn
Field E_Left[3];Left Vertices
Field E_Right[3];Right Vertices
Field E_Top[3];Top Vertices
Field E_Bottom[3];Bottom Vertices
Field E_Front[3];Front Vertices
Field E_Triangle[9];Triangles/Faces
Field surfleft,surfright,surftop,surfbottom,surffront
End Type
Function FUNC_Create_Ground.TYPE_Ground(x#,y#,z#,mdl$=1,turn%=0)
Local a.TYPE_Ground = New TYPE_Ground
a\F_X = x
a\F_Y = y
a\F_Z = z
a\I_Turn = turn
;Complex Piece Creation
a\E_Point = CreateMesh()
PositionEntity a\E_Point,x,y,0,1
Select mdl
Case 1
a\surfleft = CreateSurface(a\E_Point)
a\surfright = CreateSurface(a\E_Point)
a\surftop = CreateSurface(a\E_Point)
a\surfbottom = CreateSurface(a\E_Point)
a\surffront = CreateSurface(a\E_Point)
;Left Vertices
a\E_Left[0] = AddVertex(a\surfleft,-1,-1,1,1,.5);Bottom Back Vertex ; Front being closer to the camera
a\E_Left[1] = AddVertex(a\surfleft,-1,-1,-1,0,.5);Bottom Front Vertex
a\E_Left[2] = AddVertex(a\surfleft,-1,1,1,1,0);Top Front Vertex
a\E_Left[3] = AddVertex(a\surfleft,-1,1,-1,0,0);Top Back Vertex
;Left Triangles
a\E_Triangle[0] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[3],a\E_Left[1])
a\E_Triangle[1] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[2],a\E_Left[3])
;Right Vertices
a\E_Right[0] = AddVertex(a\surfright,1,-1,1,1,.5);Bottom Back Vertex
a\E_Right[1] = AddVertex(a\surfright,1,-1,-1,0,.5);Bottom Front Vertex
a\E_Right[2] = AddVertex(a\surfright,1,1,1,1,0);Top Front Vertex
a\E_Right[3] = AddVertex(a\surfright,1,1,-1,0,0);Top Back Vertex
;Right Triangles
a\E_Triangle[2] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[2],a\E_Right[0])
a\E_Triangle[3] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[3],a\E_Right[2])
;Top Vertices
a\E_Top[0] = AddVertex(a\surftop,-1,1,1,1,.5);Left Back Vertex
a\E_Top[1] = AddVertex(a\surftop,-1,1,-1,0,.5);Left Front Vertex
a\E_Top[2] = AddVertex(a\surftop,1,1,1,1,1);Right Front Vertex
a\E_Top[3] = AddVertex(a\surftop,1,1,-1,0,1);Right Back Vertex
;Top Triangles
a\E_Triangle[4] = AddTriangle(a\surftop,a\E_Top[1],a\E_Top[2],a\E_Top[3])
a\E_Triangle[5] = AddTriangle(a\surftop,a\E_Top[1],a\E_Top[0],a\E_Top[2])
;Bottom Vertices
a\E_Bottom[0] = AddVertex(a\surfbottom,-1,-1,1,1,.5);Left Back Vertex
a\E_Bottom[1] = AddVertex(a\surfbottom,-1,-1,-1,0,.5);Left Front Vertex
a\E_Bottom[2] = AddVertex(a\surfbottom,1,-1,1,1,1);Right Front Vertex
a\E_Bottom[3] = AddVertex(a\surfbottom,1,-1,-1,0,1);Right Back Vertex
;Bottom Triangles
a\E_Triangle[6] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[1],a\E_Bottom[3])
a\E_Triangle[7] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[3],a\E_Bottom[2])
;Front Vertices
a\E_Front[0] = AddVertex(a\surffront,-1,-1,-1,1,.5);Bottom Left Vertex
a\E_Front[1] = AddVertex(a\surffront,1,-1,-1,0,.5);Bottom Right Vertex
a\E_Front[2] = AddVertex(a\surffront,-1,1,-1,1,0);Top Left Vertex
a\E_Front[3] = AddVertex(a\surffront,1,1,-1,0,0);Top Right Vertex
;Front Triangles
a\E_Triangle[8] = AddTriangle(a\surffront,a\E_Front[0],a\E_Front[3],a\E_Front[1])
a\E_Triangle[9] = AddTriangle(a\surffront,a\E_Front[0],a\E_Front[2],a\E_Front[3])
Case 2
a\surfleft = CreateSurface(a\E_Point)
a\surfright = CreateSurface(a\E_Point)
a\surfbottom = CreateSurface(a\E_Point)
a\surffront = CreateSurface(a\E_Point)
If a\I_Turn = 0; /|
;Left Vertices
a\E_Left[0] = AddVertex(a\surfleft,-1,-1,1,1,.5);Left Bottom Back
a\E_Left[1] = AddVertex(a\surfleft,-1,-1,-1,0,.5);Left Bottom Front
a\E_Left[2] = AddVertex(a\surfleft,1,1,1,1,1);Right Top Back
a\E_Left[3] = AddVertex(a\surfleft,1,1,-1,0,1);Right Top Front
;Left Triangles
a\E_Triangle[0] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[3],a\E_Left[1])
a\E_Triangle[1] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[2],a\E_Left[3])
;Right Vertices
a\E_Right[0] = AddVertex(a\surfright,1,-1,1,1,.5);Right Bottom Back
a\E_Right[1] = AddVertex(a\surfright,1,-1,-1,0,.5);Right Bottom Front
a\E_Right[2] = AddVertex(a\surfright,1,1,1,1,1);Right Top Back
a\E_Right[3] = AddVertex(a\surfright,1,1,-1,0,1);Right Top Front
;Right Triangles
a\E_Triangle[2] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[2],a\E_Right[0])
a\E_Triangle[3] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[3],a\E_Right[2])
;Bottom Vertices
a\E_Bottom[0] = AddVertex(a\surfbottom,-1,-1,1,1,.5);Left Bottom Back
a\E_Bottom[1] = AddVertex(a\surfbottom,-1,-1,-1,0,.5);Left Bottom Front
a\E_Bottom[2] = AddVertex(a\surfbottom,1,-1,1,1,1);Right Bottom Back
a\E_Bottom[3] = AddVertex(a\surfbottom,1,-1,-1,0,1);Right Bottom Front
;Bottom Triangles
a\E_Triangle[6] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[1],a\E_Bottom[3])
a\E_Triangle[7] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[3],a\E_Bottom[2])
;Front Vertices
a\E_Front[0] = AddVertex(a\surffront,-1,-1,-1,1,.5);Left Bottom Front
a\E_Front[1] = AddVertex(a\surffront,1,-1,-1,0,.5);Right Bottom Front
a\E_Front[3] = AddVertex(a\surffront,1,1,-1,0,0);Right Top Front
;Front Triangles
a\E_Triangle[8] = AddTriangle(a\surffront,a\E_Front[0],a\E_Front[3],a\E_Front[1])
ElseIf a\I_Turn = 1 ; |\
;Left Vertices
a\E_Left[0] = AddVertex(a\surfleft,-1,-1,1,1,.5);Left Bottom Back
a\E_Left[1] = AddVertex(a\surfleft,-1,-1,-1,0,.5);Left Bottom Front
a\E_Left[2] = AddVertex(a\surfleft,-1,1,1,1,1);Left Top Back
a\E_Left[3] = AddVertex(a\surfleft,-1,1,-1,0,1);Left Top Front
;Left Triangles
a\E_Triangle[0] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[3],a\E_Left[1])
a\E_Triangle[1] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[2],a\E_Left[3])
;Right Vertices
a\E_Right[0] = AddVertex(a\surfright,1,-1,1,1,.5);Right Bottom Back
a\E_Right[1] = AddVertex(a\surfright,1,-1,-1,0,.5);Right Bottom Front
a\E_Right[2] = AddVertex(a\surfright,-1,1,1,1,1);Left Top Back
a\E_Right[3] = AddVertex(a\surfright,-1,1,-1,0,1);Left Top Front
;Right Triangles
a\E_Triangle[2] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[2],a\E_Right[0])
a\E_Triangle[3] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[3],a\E_Right[2])
;Bottom Vertices
a\E_Bottom[0] = AddVertex(a\surfbottom,-1,-1,1,1,.5);Left Bottom Back
a\E_Bottom[1] = AddVertex(a\surfbottom,-1,-1,-1,0,.5);Left Bottom Front
a\E_Bottom[2] = AddVertex(a\surfbottom,1,-1,1,1,1);Right Bottom Back
a\E_Bottom[3] = AddVertex(a\surfbottom,1,-1,-1,0,1);Right Bottom Front
;Bottom Triangles
a\E_Triangle[6] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[1],a\E_Bottom[3])
a\E_Triangle[7] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[3],a\E_Bottom[2])
;Front Vertices
a\E_Front[0] = AddVertex(a\surffront,-1,-1,-1,1,.5);Left Bottom Front
a\E_Front[1] = AddVertex(a\surffront,1,-1,-1,0,.5);Right Bottom Front
a\E_Front[3] = AddVertex(a\surffront,-1,1,-1,0,0);Left Top Front
;Front Triangles
a\E_Triangle[8] = AddTriangle(a\surffront,a\E_Front[0],a\E_Front[3],a\E_Front[1])
ElseIf a\I_Turn = 2; |/
;Left Vertices
a\E_Left[0] = AddVertex(a\surfleft,-1,-1,1,1,.5);Left Bottom Back
a\E_Left[1] = AddVertex(a\surfleft,-1,-1,-1,0,.5);Left Bottom Front
a\E_Left[2] = AddVertex(a\surfleft,-1,1,1,1,1);Left Top Back
a\E_Left[3] = AddVertex(a\surfleft,-1,1,-1,0,1);Left Top Front
;Left Triangles
a\E_Triangle[0] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[3],a\E_Left[1])
a\E_Triangle[1] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[2],a\E_Left[3])
;Top Vertices
a\E_Right[0] = AddVertex(a\surfright,1,1,1,1,.5);Right Top Back
a\E_Right[1] = AddVertex(a\surfright,1,1,-1,0,.5);Right Top Front
a\E_Right[2] = AddVertex(a\surfright,-1,1,1,1,1);Left Top Back
a\E_Right[3] = AddVertex(a\surfright,-1,1,-1,0,1);Left Top Front
;Top Triangles
a\E_Triangle[2] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[2],a\E_Right[0])
a\E_Triangle[3] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[3],a\E_Right[2])
;Bottom Vertices
a\E_Bottom[0] = AddVertex(a\surfbottom,-1,-1,1,1,.5);Left Bottom Back
a\E_Bottom[1] = AddVertex(a\surfbottom,-1,-1,-1,0,.5);Left Bottom Front
a\E_Bottom[2] = AddVertex(a\surfbottom,1,1,1,1,1);Right Top Back
a\E_Bottom[3] = AddVertex(a\surfbottom,1,1,-1,0,1);Right Top Front
;Bottom Triangles
a\E_Triangle[6] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[1],a\E_Bottom[3])
a\E_Triangle[7] = AddTriangle(a\surfbottom,a\E_Bottom[0],a\E_Bottom[3],a\E_Bottom[2])
;Front Vertices
a\E_Front[0] = AddVertex(a\surffront,-1,-1,-1,0,.5);Left Bottom Front
a\E_Front[1] = AddVertex(a\surffront,1,1,-1,1,0);Right Top Front
a\E_Front[3] = AddVertex(a\surffront,-1,1,-1,0,0);Left Top Front
;Front Triangles
a\E_Triangle[8] = AddTriangle(a\surffront,a\E_Front[0],a\E_Front[3],a\E_Front[1])
ElseIf a\I_Turn = 3; \|
;Left Vertices
a\E_Left[0] = AddVertex(a\surfleft,1,-1,1,1,.5);Right Bottom Back
a\E_Left[1] = AddVertex(a\surfleft,1,-1,-1,0,.5);Right Bottom Front
a\E_Left[2] = AddVertex(a\surfleft,-1,1,1,1,1);Left Top Back
a\E_Left[3] = AddVertex(a\surfleft,-1,1,-1,0,1);Left Top Front
;Left Triangles
a\E_Triangle[0] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[3],a\E_Left[1])
a\E_Triangle[1] = AddTriangle(a\surfleft,a\E_Left[0],a\E_Left[2],a\E_Left[3])
;Right Vertices
a\E_Right[0] = AddVertex(a\surfright,1,1,1,1,.5);Right Top Back
a\E_Right[1] = AddVertex(a\surfright,1,1,-1,0,.5);Right Top Front
a\E_Right[2] = AddVertex(a\surfright,-1,1,1,1,1);Left Top Back
a\E_Right[3] = AddVertex(a\surfright,-1,1,-1,0,1);Left Top Front
;Right Triangles
a\E_Triangle[2] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[2],a\E_Right[0])
a\E_Triangle[3] = AddTriangle(a\surfright,a\E_Right[1],a\E_Right[3],a\E_Right[2])
;Bottom Vertices
a\E_Bottom[0] = AddVertex(a\surfbottom,1,1,1,1,.5);Right Top Back
a\E_Bottom[1] = AddVertex(a\surfbottom,1,1,-1,0,.5);Right Top Front
a\E_Bottom[2] = AddVertex(a\surfbottom,1,-1,1,1,1);Right Bottom Back
a\E_Bottom[3] = AddVertex(a\surfbottom,1,-1,-1,0,1);Right Bottom Front
;Bottom Triangles
a\E_Triangle[6] = AddTriangle(a\surfbottom,a\E_Bottom[2],a\E_Bottom[3],a\E_Bottom[0])
a\E_Triangle[7] = AddTriangle(a\surfbottom,a\E_Bottom[1],a\E_Bottom[0],a\E_Bottom[3])
;Front Vertices
a\E_Front[0] = AddVertex(a\surffront,1,-1,-1,0,.5);Right Bottom Front
a\E_Front[1] = AddVertex(a\surffront,1,1,-1,1,0);Right Top Front
a\E_Front[3] = AddVertex(a\surffront,-1,1,-1,0,0);Left Top Front
;Front Triangles
a\E_Triangle[8] = AddTriangle(a\surffront,a\E_Front[0],a\E_Front[3],a\E_Front[1])
EndIf
a\I_AngledMdl = 1
End Select
EntityFX a\E_Point,2
UpdateComplexPieces()
UpdateNormals a\E_Point
;End of Complex Piece Creation
EntityTexture a\E_Point,elementtexture
PositionEntity a\E_Point,a\F_X,a\F_Y,a\F_Z
Return a
End Function
Function UpdateComplexPieces()
Local a.TYPE_Ground,b.TYPE_Ground
For a.TYPE_Ground = Each TYPE_Ground
For b.TYPE_Ground = Each TYPE_Ground
If a\I_AngledMdl = 0 And b\I_AngledMdl = 0
If EntityX(b\E_Point) = EntityX(a\E_Point) + 2;If second entity is to the right of first entity
If (EntityY(b\E_Point) = EntityY(a\E_Point))
ClearSurface b\surfleft
ClearSurface a\surfright
EndIf
EndIf
If EntityX(b\E_Point) = EntityX(a\E_Point) - 2;If second entity is to the left of first entity
If (EntityY(b\E_Point) = EntityY(a\E_Point))
ClearSurface b\surfright
ClearSurface a\surfleft
EndIf
EndIf
If EntityY(b\E_Point) = EntityY(a\E_Point) + 2;If second entity is above the first entity
If (EntityX(b\E_Point) = EntityX(a\E_Point))
ClearSurface b\surfbottom
ClearSurface a\surftop
EndIf
EndIf
If EntityY(b\E_Point) = EntityY(a\E_Point) - 2;If second entity is under the first entity
If (EntityX(b\E_Point) = EntityX(a\E_Point))
ClearSurface b\surftop
ClearSurface a\surfbottom
EndIf
EndIf
EndIf
If a\I_AngledMdl = 1 And b\I_AngledMdl = 0
Select a\I_Turn
Case 0; /|
If EntityX(b\E_Point) = EntityX(a\E_Point) + 2;If second entity is to the right of first entity
If (EntityY(b\E_Point) = EntityY(a\E_Point))
ClearSurface b\surfleft
ClearSurface a\surfright
EndIf
EndIf
If EntityY(b\E_Point) = EntityY(a\E_Point) - 2;If second entity is under the first entity
If (EntityX(b\E_Point) = EntityX(a\E_Point))
ClearSurface b\surftop
ClearSurface a\surfbottom
EndIf
EndIf
Case 1; |\
If EntityX(b\E_Point) = EntityX(a\E_Point) - 2;If second entity is to the left of first entity
If (EntityY(b\E_Point) = EntityY(a\E_Point))
ClearSurface b\surfright
ClearSurface a\surfleft
EndIf
EndIf
If EntityY(b\E_Point) = EntityY(a\E_Point) - 2;If second entity is under the first entity
If (EntityX(b\E_Point) = EntityX(a\E_Point))
ClearSurface b\surftop
ClearSurface a\surfbottom
EndIf
EndIf
Case 2; |/
If EntityX(b\E_Point) = EntityX(a\E_Point) - 2;If second entity is to the left of first entity
If (EntityY(b\E_Point) = EntityY(a\E_Point))
ClearSurface b\surfright
ClearSurface a\surfleft
EndIf
EndIf
If EntityY(b\E_Point) = EntityY(a\E_Point) + 2;If second entity is above the first entity
If (EntityX(b\E_Point) = EntityX(a\E_Point))
ClearSurface b\surfbottom
ClearSurface a\surfright
EndIf
EndIf
Case 3; \|
If EntityX(b\E_Point) = EntityX(a\E_Point) + 2;If second entity is to the right of first entity
If (EntityY(b\E_Point) = EntityY(a\E_Point))
ClearSurface b\surfleft
ClearSurface a\surfbottom
EndIf
EndIf
If EntityY(b\E_Point) = EntityY(a\E_Point) + 2;If second entity is above the first entity
If (EntityX(b\E_Point) = EntityX(a\E_Point))
ClearSurface b\surfbottom
ClearSurface a\surfright
EndIf
EndIf
End Select
EndIf
Next
Next
End Function