The mesh is just a bunch of quads stuck together with the intention of texturing each quad separately.
The ultimate aim will be to load an image, break it into textures, and apply each texture to the appropriate surface.
I've got your plane idea working now - excellent idea. Many thanks.
With FitMesh commented out, everything is fine.
Use the arrow keys to move around, and + or - to zoom in or out.
Note that the camera range is very small so it won't take much zooming for the image to go out of camera range.
With FitMesh I want to centre the mesh on the screen, and have it fill the screen vertically. I've used some hardcoded values in FitMesh to try and figure out what is going on, but it continues to defeat me.
The ultimate aim will be to load an image, break it into textures, and apply each texture to the appropriate surface.
I've got your plane idea working now - excellent idea. Many thanks.
With FitMesh commented out, everything is fine.
Use the arrow keys to move around, and + or - to zoom in or out.
Note that the camera range is very small so it won't take much zooming for the image to go out of camera range.
With FitMesh I want to centre the mesh on the screen, and have it fill the screen vertically. I've used some hardcoded values in FitMesh to try and figure out what is going on, but it continues to defeat me.
Graphics3D 1024,768,32,2 SetBuffer BackBuffer() WireFrame True Const texMaxSize=256 Type quad Field surface Field vertex[3] Field imageLeft Field imageRight Field imageTop Field imageBottom End Type Global mesh Global qd.quad Global camNear#=1 Global camFar#=2 Global cam=CreateCamera() CameraRange cam,camNear,camFar Global boundLeft# Global boundRight# Global boundTop# Global boundBottom# Local plane=CreatePlane() EntityPickMode plane,2 PositionEntity plane,0,0,camNear+((camFar-camNear)/2.0) RotateEntity plane,-90,0,0 CameraPick(cam,0,0) boundLeft=PickedX() boundTop=PickedY() CameraPick(cam,GraphicsWidth(),GraphicsHeight()) boundRight=PickedX() boundBottom=PickedY() FreeEntity plane buildMesh() ;FitMesh mesh,-1,-0.5,EntityZ(mesh),2,1,MeshDepth(mesh) Repeat UpdateMesh() RenderWorld Flip True Until KeyHit(1) End Function UpdateMesh() Local dist#=0.01 If KeyDown(203) Then MoveEntity mesh,dist,0,0 EndIf If KeyDown(205) Then MoveEntity mesh,-dist,0,0 EndIf If KeyDown(200) Then MoveEntity mesh,0,-dist,0 EndIf If KeyDown(208) Then MoveEntity mesh,0,dist,0 EndIf If KeyDown(78) Then MoveEntity mesh,0,0,-dist EndIf If KeyDown(74) Then MoveEntity mesh,0,0,dist EndIf End Function Function buildMesh() Local imgWidth=1000 Local imgHeight=1000 Local xCount,yCount Local xDone,yDone Local uvOffset#=0.5/texMaxSize If imgWidth<>0 Then If imgHeight<>0 Then mesh=CreateMesh() PositionEntity mesh,0,0,camNear+((camFar-camNear)/2.0) xDone=False xCount=0 While xDone=False yDone=False yCount=0 While yDone=False qd.quad=New quad qd\surface=CreateSurface(mesh) qd\vertex[0]=AddVertex(qd\surface,0+xCount,1+yCount,0,0+uvOffset,0+uvOffset) qd\vertex[1]=AddVertex(qd\surface,1+xCount,1+yCount,0,1-uvOffset,0+uvOffset) qd\vertex[2]=AddVertex(qd\surface,1+xCount,0+yCount,0,1-uvOffset,1-uvOffset) qd\vertex[3]=AddVertex(qd\surface,0+xCount,0+yCount,0,0+uvOffset,1-uvOffset) AddTriangle(qd\surface,qd\vertex[0],qd\vertex[1],qd\vertex[3]) AddTriangle(qd\surface,qd\vertex[2],qd\vertex[3],qd\vertex[1]) qd\imageLeft=(xCount*texMaxSize)-xCount qd\imageRight=qd\imageLeft+texMaxSize If qd\imageRight>=imgWidth Then qd\imageRight=imgWidth xDone=True EndIf qd\imageBottom=imgHeight-(yCount*texMaxSize)-yCount qd\imageTop=qd\imageBottom-texMaxSize If qd\imageTop<=0 Then qd\imageTop=0 yDone=True EndIf yCount=yCount+1 Wend xCount=xCount+1 Wend EndIf EndIf End Function