Archived

This topic is now archived and is closed to further replies.

xg0blin

textured meshes disappearing

Recommended Posts

I am doing an assignment for school. I made a mesh class (my own file format kinda), that does textured meshes in computer graphics I. I used it in my camera demo I''m working on, and I get a problem No matter what I set my gluPerspective far clipping plane at, the house meshes disappear when I move away from them too far, but yet, my sky box behind them remains. Also, the textures look really ragged, and flash alot. Anyone know how to fix this?

Share this post


Link to post
Share on other sites
ok. Here goes.


Vector.h

  
#ifndef Vector_h
#define Vector_h

#include <cmath>

class Vector
{
public:
double x, y, z;
Vector(double = 0.0, double = 0.0, double = 0.0);
void operator =(const Vector);
};

Vector Normalize(Vector);
Vector CrossProduct(Vector, Vector);
double DotProduct(Vector, Vector);
double Norm(Vector);
Vector operator +(const Vector, const Vector);
Vector operator -(const Vector, const Vector);

#endif



Vector.cpp

  
#include "Vector.h"

Vector::Vector(double X, double Y, double Z)
{
x = X;
y = Y;
z = Z;
}

void Vector::operator =(const Vector Vect1)
{
x = Vect1.x;
y = Vect1.y;
z = Vect1.z;
}

Vector Normalize(Vector Vect)
{
double norm = Norm(Vect);

Vect.x /= norm;
Vect.y /= norm;
Vect.z /= norm;

return Vect;
}


Vector CrossProduct(Vector Vect1, Vector Vect2)
{
Vector Temp;

Temp.x = Vect1.y * Vect2.z - Vect1.z * Vect2.y;
Temp.y = Vect1.z * Vect2.x - Vect1.x * Vect2.z;
Temp.z = Vect1.x * Vect2.y - Vect1.y * Vect2.x;

return Temp;
}


double DotProduct(Vector Vect1, Vector Vect2)
{
return (Vect1.x * Vect2.x + Vect1.y * Vect2.y + Vect1.z * Vect2.z);
}


double Norm(Vector Vect)
{
return sqrt(Vect.x * Vect.x + Vect.y * Vect.y + Vect.z * Vect.z);
}


Vector operator +(const Vector Vect1, const Vector Vect2)
{
Vector Temp;

Temp.x = Vect1.x + Vect2.x;
Temp.y = Vect1.y + Vect2.y;
Temp.z = Vect1.z + Vect2.z;

return Temp;
}


Vector operator -(const Vector Vect1, const Vector Vect2)
{
Vector Temp;

Temp.x = Vect1.x - Vect2.x;
Temp.y = Vect1.y - Vect2.y;
Temp.z = Vect1.z - Vect2.z;

return Temp;
}



mesh.h

  
#ifndef mesh_h
#define mesh_h

#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include "Vector.h"

struct VertNormIndex
{
int VertIndex, NormIndex, TexIndex;
};


struct Face
{
int VerticesNum, TexIdentity;
VertNormIndex *vid;
};

struct Texture
{
GLfloat x, y;
};

class Mesh
{
private:
int NumVertices, NumNormals, NumFaces;
int NumTextures, NumTexCoordinates;
Vector *point, *norm;
Face *face;
Texture *texture;

public:
Mesh();
~Mesh();
void ReadMesh(char *);
void DrawMesh(unsigned int[]);
void WriteMesh(char *);
};

#endif



mesh.cpp

  
#include "mesh.h"

#include "mesh.h"
#include <fstream>
using std::fstream;

Mesh::Mesh()
{
point = NULL;
norm = NULL;
face = NULL;
texture = NULL;
}

Mesh::~Mesh()
{
if(point)
delete [] point;
if(norm)
delete [] norm;
if(face)
delete [] face;
if(texture)
delete [] texture;
}

void Mesh::ReadMesh(char *FileName)
{
fstream InFile;

InFile.open(FileName, std::ios::in);

if(!FileName)
return;

InFile >> NumVertices >> NumNormals
>> NumTexCoordinates >> NumTextures
>> NumFaces;

point = new Vector[NumVertices];
norm = new Vector[NumNormals];
face = new Face[NumFaces];
texture = new Texture[NumTexCoordinates];

for(int PointCount = 0;
PointCount < NumVertices;
PointCount++)
InFile >> point[PointCount].x
>> point[PointCount].y
>> point[PointCount].z;

for(int NormCount = 0;
NormCount < NumNormals;
NormCount++)
InFile >> norm[NormCount].x
>> norm[NormCount].y
>> norm[NormCount].z;

for(int TextureCount = 0;
TextureCount < NumTexCoordinates;
TextureCount++)
InFile >> texture[TextureCount].x
>> texture[TextureCount].y;

for(int FaceCount = 0;
FaceCount < NumFaces;
FaceCount++)
{
InFile >> face[FaceCount].VerticesNum;

face[FaceCount].vid = new VertNormIndex[face[FaceCount].VerticesNum];

for(int VertIndexCount = 0;
VertIndexCount < face[FaceCount].VerticesNum;
VertIndexCount++)
InFile >> face[FaceCount].vid[VertIndexCount].VertIndex;

for(int NormIndexCount = 0;
NormIndexCount < face[FaceCount].VerticesNum;
NormIndexCount++)
InFile >> face[FaceCount].vid[NormIndexCount].NormIndex;

for(int TexIndexCount = 0;
TexIndexCount < face[FaceCount].VerticesNum;
TexIndexCount++)
InFile >> face[FaceCount].vid[TexIndexCount].TexIndex;

InFile >> face[FaceCount].TexIdentity;
}
InFile.close();
}

void Mesh::DrawMesh(unsigned int texarray[])
{
for(int FaceCount = 0;
FaceCount < NumFaces;
FaceCount++)
{
int Number = face[FaceCount].VerticesNum;
glBindTexture(GL_TEXTURE_2D,
texarray[face[FaceCount].TexIdentity]);
glBegin(GL_POLYGON);
for(int VertCount = 0;
VertCount < Number;
VertCount++)
{
int Index = face[FaceCount].VerticesNum;

glNormal3f(norm[Index].x,
norm[Index].y,
norm[Index].z);

int TexIndex = face[FaceCount].vid[VertCount].TexIndex;
glTexCoord2f(texture[TexIndex].x,
texture[TexIndex].y);

int VertIndex = face[FaceCount].vid[VertCount].VertIndex;
glVertex3f(point[VertIndex].x,
point[VertIndex].y,
point[VertIndex].z);
}
glEnd();
}
}

void Mesh::WriteMesh(char *FileName)
{
fstream OutFile;
OutFile.open(FileName, std::ios::out|std::ios::trunc);

if(OutFile.fail())
return;

OutFile << NumVertices << " "
<< NumNormals << " " << NumTexCoordinates
<< " " << NumTextures << " "
<< NumFaces << "\n";

for(int PointCount = 0;
PointCount < NumVertices;
PointCount++)
OutFile << point[PointCount].x << " "
<< point[PointCount].y << " "
<< point[PointCount].z << "\n";

for(int NormCount = 0;
NormCount < NumNormals;
NormCount++)
OutFile << norm[NormCount].x << " "
<< norm[NormCount].y << " "
<< norm[NormCount].z << "\n";

for(int TextureCount = 0;
TextureCount < NumTexCoordinates;
TextureCount++)
OutFile << texture[TextureCount].x << " "
<< texture[TextureCount].y << "\n";

for(int FaceCount = 0;
FaceCount < NumFaces;
FaceCount++)
{
OutFile << face[FaceCount].VerticesNum << " ";

for(int VertIndexCount=0;
VertIndexCount < face[FaceCount].VerticesNum;
VertIndexCount++)
OutFile << face[FaceCount].vid[VertIndexCount].VertIndex << " ";
OutFile << " ";

for(int NormIndexCount = 0;
NormIndexCount < face[FaceCount].VerticesNum;
NormIndexCount++)
OutFile << face[FaceCount].vid[NormIndexCount].NormIndex << " ";
OutFile << " ";

for(int TexIndexCount = 0;
TexIndexCount < face[FaceCount].VerticesNum;
TexIndexCount++)
OutFile << face[FaceCount].vid[TexIndexCount].TexIndex << " ";

OutFile << " ";
OutFile << face[FaceCount].TexIdentity << " ";
OutFile << "\n";
}
}



camera.h

  
#ifndef Camera_h
#define Camera_h

#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include "Vector.h"

#define SPEED 15
#define PI 3.14159
#define SCREENWIDTH 1024
#define SCREENHEIGHT 768

class Camera
{
private:
Vector Position, View, Up;
double FrameInterval, MouseSensitivity;

public:
bool UpPressed, DownPressed, RightPressed, LeftPressed;

Camera(double = 0.0, double = 0.0, double = 0.0,
double = 0.0, double = 0.0, double = 0.0,
double = 0.0, double = 0.0, double = 0.0);
Vector GetPosition(void);
Vector GetView(void);
Vector GetUp(void);
void SetCamera(double, double, double, double, double, double, double, double, double);
void CheckForMovement(void);
void UpdateCamera(void);
void Look(void);
void SlideCamera(double);
void StrafeCamera(double);
void RotateCamera(double, double, double, double);
void SetViewByMouse(void);
void CalculateFrameRate(void);
};

#endif



camera.cpp

  
#include "Camera.h"

Camera::Camera(double PositX, double PositY, double PositZ,
double ViewX, double ViewY, double ViewZ,
double UpX, double UpY, double UpZ)
{
Position.x = PositX;
Position.y = PositY;
Position.z = PositZ;

View.x = ViewX;
View.y = ViewY;
View.z = ViewZ;

Up.x = UpX;
Up.y = UpY;
Up.z = UpZ;

FrameInterval = 0.0;

UpPressed=DownPressed=LeftPressed=RightPressed=false;

MouseSensitivity = 1000;
}

Vector Camera::GetPosition(void)
{
return Position;
}

Vector Camera::GetView(void)
{
return View;
}

Vector Camera::GetUp(void)
{
return Up;
}

void Camera::SetCamera(double PositX = 0.0, double PositY = 3.0, double PositZ = 5.0,
double ViewX = 0.0, double ViewY = 0.0, double ViewZ = -5.0,
double UpX = 0.0, double UpY = 1.0, double UpZ = 0.0)
{
Position.x = PositX;
Position.y = PositY;
Position.z = PositZ;

View.x = ViewX;
View.y = ViewY;
View.z = ViewZ;

Up.x = UpX;
Up.y = UpY;
Up.z = UpZ;
}

void Camera::CheckForMovement(void)
{
double LocalSpeed = FrameInterval * SPEED;

if(UpPressed)
SlideCamera(LocalSpeed);
if(DownPressed)
SlideCamera(-LocalSpeed);
if(LeftPressed)
StrafeCamera(-LocalSpeed);
if(RightPressed)
StrafeCamera(LocalSpeed);
}

void Camera::UpdateCamera(void)
{
SetViewByMouse();
CheckForMovement();
CalculateFrameRate();
}

void Camera::Look(void)
{
gluLookAt(Position.x, Position.y, Position.z,
View.x, View.y, View.z,
Up.x, Up.y, Up.z);
}

void Camera::SlideCamera(double speed)
{
Vector NewView = View - Position;
NewView = Normalize(NewView);

Position.x += NewView.x * speed;
Position.y += NewView.y * speed;
Position.z += NewView.z * speed;

View.x += NewView.x * speed;
View.y += NewView.y * speed;
View.z += NewView.z * speed;
}

void Camera::StrafeCamera(double speed)
{
Vector Strafe = Normalize(CrossProduct(View - Position, Up));

Position.x += Strafe.x * speed;
Position.z += Strafe.z * speed;

View.x += Strafe.x * speed;
View.z += Strafe.z * speed;
}

void Camera::RotateCamera(double Angle, double x, double y, double z)
{
Vector vNewView;

// Get the view vector (The direction we are facing)

Vector vView = View - Position;

// Calculate the sine and cosine of the angle once

float cosTheta = (float)cos(Angle);
float sinTheta = (float)sin(Angle);

// Find the new x position for the new rotated point

vNewView.x = (cosTheta + (1 - cosTheta) * x * x) * vView.x;
vNewView.x += ((1 - cosTheta) * x * y - z * sinTheta) * vView.y;
vNewView.x += ((1 - cosTheta) * x * z + y * sinTheta) * vView.z;

// Find the new y position for the new rotated point

vNewView.y = ((1 - cosTheta) * x * y + z * sinTheta) * vView.x;
vNewView.y += (cosTheta + (1 - cosTheta) * y * y) * vView.y;
vNewView.y += ((1 - cosTheta) * y * z - x * sinTheta) * vView.z;

// Find the new z position for the new rotated point

vNewView.z = ((1 - cosTheta) * x * z - y * sinTheta) * vView.x;
vNewView.z += ((1 - cosTheta) * y * z + x * sinTheta) * vView.y;
vNewView.z += (cosTheta + (1 - cosTheta) * z * z) * vView.z;

// Now we just add the newly rotated vector to our position to set

// our new rotated view of our camera.

View = Position + vNewView;
}

void Camera::SetViewByMouse(void)
{
int MouseX, MouseY;
int MiddleX = SCREENWIDTH/2;
int MiddleY = SCREENHEIGHT/2;
Vector MouseDirection(0, 0, 0);
static double CurrentRotationX = 0.0;

SDL_GetMouseState(&MouseX, &MouseY);

if((MouseX == MiddleX) && (MouseY == MiddleY))
return;

SDL_WarpMouse(MiddleX, MiddleY);

MouseDirection.x = (MiddleX - MouseX)/MouseSensitivity;
MouseDirection.y = (MiddleY - MouseY)/MouseSensitivity;

CurrentRotationX -= MouseDirection.y;

if(CurrentRotationX > 1.0)
CurrentRotationX = 1.0;
if(CurrentRotationX < -1.0)
CurrentRotationX = -1.0;

else
{
Vector Axis = CrossProduct(View - Position, Up);
Axis = Normalize(Axis);

RotateCamera(MouseDirection.y, Axis.x, Axis.y, Axis.z);
RotateCamera(MouseDirection.x, 0, 1, 0);
}
}

void Camera::CalculateFrameRate(void)
{
static double fps = 0.0;
static double PreviousTime = 0.0;
static double FrameTime = 0.0;
char WindowFPSCounter[10] = {0};
float CurrentTime = SDL_GetTicks() * 0.001f;

FrameInterval = CurrentTime - FrameTime;
FrameTime = CurrentTime;

fps++;


if(CurrentTime - PreviousTime > 1.0)
{
PreviousTime = CurrentTime;
sprintf(WindowFPSCounter, "FPS: %d", (int)fps);
SDL_WM_SetCaption(WindowFPSCounter, "Robert''s Camera Demo");
fps = 0.0;
}
}



ImageLoad.h

  
#include <il/il.h>
#include <il/ilu.h>
#include <il/ilut.h>

class ImageLoader
{
public:
ImageLoader()
{
ilStartup();
ilutStartup();
ilutRenderer(ILUT_OPENGL);
ilutEnable(ILUT_OPENGL_CONV);
};

bool CreateTextures(unsigned int[], char *, int);
};

#endif



ImageLoad.cpp

  
#include "ImageLoad.h"

bool ImageLoader::CreateTextures(unsigned int texture[], char *name, int index)
{
ILuint ImageID;
ilGenImages(1, &ImageID);
ilBindImage(ImageID);


if(ilLoadImage(name))
{
ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);

glGenTextures(1, &texture[index]);

glBindTexture(GL_TEXTURE_2D, texture[index]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
ilutGLBuildMipmaps();

ilDeleteImages(1, &ImageID);
}
else
return false;

return true;
}



Engine.h

  
#ifndef Engine_h
#define Engine_h

#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <iostream.h>
#include <stdlib.h>
#include "Camera.h"
#include "ImageLoad.h"
#include "mesh.h"

class Engine
{
private:
Camera EngineCam;
ImageLoader Loader;
Mesh HouseMesh;
SDL_Surface *MainWindow;
int VideoFlags, WindowWidth, WindowHeight, WindowDepth;
unsigned int textures[3], housetextures[4];

public:
Engine()
{
VideoFlags = 0;
WindowWidth = 1024, WindowHeight = 768, WindowDepth = 16;
};

void Start(void);
void Quit(int);
void InitEngine(void);
void InitSDL(void);
void InitGL(void);
void LoadImages(void);
void MainLoop(void);
void CreateSDLWindow(const char *);
void Display(void);
void KeyPressEvent(SDL_keysym *);
void KeyReleaseEvent(SDL_keysym *);
void UpdateEngine(void);
};



#endif



Engine.cpp

  
#include "Engine.h"

void Engine::Start(void)
{
InitSDL();

SDL_WM_GrabInput(SDL_GRAB_ON);

if(SDL_ShowCursor(SDL_DISABLE != SDL_DISABLE))
cerr << SDL_GetError() << endl;

if(SDL_EnableKeyRepeat(100, SDL_DEFAULT_REPEAT_INTERVAL))
{
cerr << "Failed enabling key repeat" << endl;
Quit(1);
}

CreateSDLWindow("Robert''s Camera Demo");

InitGL();

EngineCam.SetCamera(0.0, 5.0, 50.0, 0.0, 0.0, -125.0, 0.0, 1.0, 0.0);

MainLoop();
}

void Engine::Quit(int ret_value)
{
SDL_Quit();
exit(ret_value);
}

void Engine::InitSDL(void)
{
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
cerr << "Could not initialize SDL_VIDEO" << endl;
Quit(0);
}

const SDL_VideoInfo *VideoInfo = SDL_GetVideoInfo();

if(VideoInfo == NULL)
{
cerr << "Could not get VideoInfo" << endl;
Quit(0);
}

VideoFlags = SDL_OPENGL;
VideoFlags |= SDL_HWPALETTE;
VideoFlags |= SDL_RESIZABLE;

if(VideoInfo->hw_available)
VideoFlags |= SDL_HWSURFACE;
else
VideoFlags |= SDL_SWSURFACE;

if(VideoInfo->blit_hw)
VideoFlags |= SDL_HWACCEL;

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, WindowDepth);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0);
}

void Engine::InitGL(void)
{
glViewport(0, 0, WindowWidth, WindowHeight);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_DEPTH_TEST);
glCullFace(GL_CCW);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0, 4/3, 0.001, 256.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
LoadImages();
HouseMesh.ReadMesh("barn.dat");
}

void Engine::LoadImages(void)
{
Loader.CreateTextures(textures, "floor2.tga", 0);
Loader.CreateTextures(textures, "wall.tga", 1);
Loader.CreateTextures(textures, "sky.tga", 2);
Loader.CreateTextures(housetextures, "front.tga", 0);
Loader.CreateTextures(housetextures, "side.tga", 1);
Loader.CreateTextures(housetextures, "back.tga", 2);
Loader.CreateTextures(housetextures, "roof.tga", 3);
}

void Engine::CreateSDLWindow(const char *WindowTitle)
{
MainWindow = SDL_SetVideoMode(WindowWidth, WindowHeight, WindowDepth, VideoFlags);

if(MainWindow == NULL)
{
cerr << "Failed to Create SDL Window" << endl;
Quit(0);
}
SDL_WM_SetCaption(WindowTitle, WindowTitle);
}

void Engine::MainLoop(void)
{
bool Working = true;
SDL_Event Event;

while(Working)
{
while(SDL_PollEvent(&Event))
{
switch(Event.type)
{
case SDL_QUIT:
Working = true;
break;
case SDL_KEYDOWN:
KeyPressEvent(&Event.key.keysym);
break;
case SDL_KEYUP:
KeyReleaseEvent(&Event.key.keysym);
break;
default:
break;
}
}
EngineCam.UpdateCamera();
Display();
}
}

void Engine::Display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

EngineCam.Look();
glColor3f(1.0f, 1.0f, 1.0f);

glBindTexture(GL_TEXTURE_2D, textures[0]);
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex3f(-128, 0, -128);
glTexCoord2i(64, 0);
glVertex3f(128, 0, -128);
glTexCoord2i(64, 64);
glVertex3f(128, 0, 128);
glTexCoord2i(0, 64);
glVertex3f(-128, 0, 128);
glEnd();

glBindTexture(GL_TEXTURE_2D, textures[1]);
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex3f(-128, 0, -128);
glTexCoord2i(16, 0);
glVertex3f(128, 0, -128);
glTexCoord2i(16, 4);
glVertex3f(128, 32, -128);
glTexCoord2i(0, 4);
glVertex3f(-128, 32, -128);

glTexCoord2i(0, 0);
glVertex3f(128, 0, -128);
glTexCoord2i(16, 0);
glVertex3f(128, 0, 128);
glTexCoord2i(16, 4);
glVertex3f(128, 32, 128);
glTexCoord2i(0, 4);
glVertex3f(128, 32, -128);

glTexCoord2i(0, 0);
glVertex3f(-128, 0, 128);
glTexCoord2i(16, 0);
glVertex3f(128, 0, 128);
glTexCoord2i(16, 4);
glVertex3f(128, 32, 128);
glTexCoord2i(0, 4);
glVertex3f(-128, 32, 128);

glTexCoord2i(0, 0);
glVertex3f(-128, 0, -128);
glTexCoord2i(16, 0);
glVertex3f(-128, 0, 128);
glTexCoord2i(16, 4);
glVertex3f(-128, 32, 128);
glTexCoord2i(0, 4);
glVertex3f(-128, 32, -128);
glEnd();

glBindTexture(GL_TEXTURE_2D, textures[2]);
glBegin(GL_POLYGON);
glTexCoord2i(0, 0);
glVertex3f(-128, 32, -128);
glTexCoord2i(1, 0);
glVertex3f(128, 32, -128);
glTexCoord2i(1, 1);
glVertex3f(128, 32, 128);
glTexCoord2i(0, 1);
glVertex3f(-128, 32, 128);
glEnd();

HouseMesh.DrawMesh(housetextures);

SDL_GL_SwapBuffers();
}

void Engine::KeyPressEvent(SDL_keysym *key)
{
Vector TempPosition = EngineCam.GetPosition();
switch(key->sym)
{
case SDLK_ESCAPE:
Quit(0);
break;
case SDLK_UP:
case SDLK_w:
EngineCam.UpPressed = true;
break;
case SDLK_DOWN:
case SDLK_s:
EngineCam.DownPressed = true;
break;
case SDLK_LEFT:
case SDLK_a:
EngineCam.LeftPressed = true;
break;
case SDLK_RIGHT:
case SDLK_d:
EngineCam.RightPressed = true;
break;
default:
break;
}
}

void Engine::KeyReleaseEvent(SDL_keysym *key)
{
switch(key->sym)
{
case SDLK_UP:
case SDLK_w:
EngineCam.UpPressed = false;
break;
case SDLK_DOWN:
case SDLK_s:
EngineCam.DownPressed = false;
break;
case SDLK_LEFT:
case SDLK_a:
EngineCam.LeftPressed = false;
break;
case SDLK_RIGHT:
case SDLK_d:
EngineCam.RightPressed = false;
break;
default:
break;
}
}



and my mesh file
barn.dat

  
10 7 7 4 7

0 0 0 10 0 0 10 10 0 5 15 0 0 10 0
0 0 10 10 0 10 10 10 10 5 15 10 0 10 10

-1 0 0 -0.707 0.707 0 0.707 0.707 0
1 0 0 0 -1 0 0 0 1 0 0 -1

0 0 1 0 1 1 0 1 1 .65 0 .65 .5 1

4 0 5 9 4 0 0 0 0 0 1 2 3 1
4 3 4 9 8 1 1 1 1 0 1 2 3 3
4 2 3 8 7 2 2 2 2 0 1 2 3 3
4 6 1 2 7 3 3 3 3 0 1 2 3 1
4 0 1 6 5 4 4 4 4 0 1 2 3 3
5 5 6 7 8 9 5 5 5 5 5 0 1 4 6 5 0
5 0 1 2 3 4 6 6 6 6 6 0 1 4 6 5 2



Hopefully you can find something I can''t. This should be enough to compile the program and run it, provided you make some dummy textures by the names in my program.

Share this post


Link to post
Share on other sites