1998-05-24 02:49:09 +00:00
|
|
|
// obj.cxx -- routines to handle "sorta" WaveFront .obj format files.
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started October 1997.
|
|
|
|
//
|
|
|
|
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
// (Log is kept at end of this file)
|
1997-10-28 21:14:54 +00:00
|
|
|
|
|
|
|
|
1998-04-24 00:51:07 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
1998-04-03 22:09:02 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
1997-10-28 21:14:54 +00:00
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1997-11-14 00:26:49 +00:00
|
|
|
#include <string.h>
|
1997-10-28 21:14:54 +00:00
|
|
|
#include <GL/glut.h>
|
1998-01-19 19:26:51 +00:00
|
|
|
#include <XGL/xgl.h>
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-07-24 21:42:06 +00:00
|
|
|
#if defined ( __sun__ )
|
1998-06-12 00:55:58 +00:00
|
|
|
extern "C" void *memmove(void *, const void *, size_t);
|
|
|
|
extern "C" void *memset(void *, int, size_t);
|
|
|
|
#endif
|
|
|
|
|
1998-07-24 21:42:06 +00:00
|
|
|
#include <string> // Standard C++ library
|
|
|
|
#include <map> // STL
|
|
|
|
|
1998-07-06 21:34:33 +00:00
|
|
|
#ifdef NEEDNAMESPACESTD
|
|
|
|
using namespace std;
|
|
|
|
#endif
|
1998-06-05 22:39:53 +00:00
|
|
|
|
1998-04-18 04:13:17 +00:00
|
|
|
#include <Debug/fg_debug.h>
|
1998-03-14 00:30:50 +00:00
|
|
|
#include <Include/fg_constants.h>
|
1998-04-28 21:42:50 +00:00
|
|
|
#include <Include/fg_zlib.h>
|
1998-04-30 12:35:26 +00:00
|
|
|
#include <Main/options.hxx>
|
1998-01-27 03:26:41 +00:00
|
|
|
#include <Math/mat3.h>
|
1998-03-14 00:30:50 +00:00
|
|
|
#include <Math/fg_random.h>
|
1998-07-08 14:47:20 +00:00
|
|
|
#include <Math/polar3d.hxx>
|
1998-05-02 01:52:14 +00:00
|
|
|
|
1998-06-05 22:39:53 +00:00
|
|
|
#include "material.hxx"
|
1998-05-02 01:52:14 +00:00
|
|
|
#include "obj.hxx"
|
|
|
|
#include "scenery.hxx"
|
1998-05-23 14:09:20 +00:00
|
|
|
#include "tile.hxx"
|
1997-10-28 21:14:54 +00:00
|
|
|
|
|
|
|
|
1998-07-12 03:18:27 +00:00
|
|
|
static double normals[MAX_NODES][3];
|
1997-10-31 04:49:12 +00:00
|
|
|
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// given three points defining a triangle, calculate the normal
|
1998-05-16 13:09:57 +00:00
|
|
|
static void calc_normal(double p1[3], double p2[3],
|
|
|
|
double p3[3], double normal[3])
|
1997-12-15 23:54:25 +00:00
|
|
|
{
|
|
|
|
double v1[3], v2[3];
|
1998-01-31 00:42:57 +00:00
|
|
|
double temp;
|
1997-12-15 23:54:25 +00:00
|
|
|
|
|
|
|
v1[0] = p2[0] - p1[0]; v1[1] = p2[1] - p1[1]; v1[2] = p2[2] - p1[2];
|
|
|
|
v2[0] = p3[0] - p1[0]; v2[1] = p3[1] - p1[1]; v2[2] = p3[2] - p1[2];
|
|
|
|
|
|
|
|
MAT3cross_product(normal, v1, v2);
|
|
|
|
MAT3_NORMALIZE_VEC(normal,temp);
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, " Normal = %.2f %.2f %.2f\n",
|
|
|
|
// normal[0], normal[1], normal[2]);
|
1997-12-15 23:54:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-04-03 22:09:02 +00:00
|
|
|
#define FG_TEX_CONSTANT 128.0
|
1998-03-14 00:30:50 +00:00
|
|
|
|
|
|
|
|
1998-05-02 01:52:14 +00:00
|
|
|
// Calculate texture coordinates for a given point.
|
1998-07-08 14:47:20 +00:00
|
|
|
fgPoint3d calc_tex_coords(double *node, fgPoint3d *ref) {
|
|
|
|
fgPoint3d cp;
|
|
|
|
fgPoint3d pp;
|
1998-03-14 00:30:50 +00:00
|
|
|
|
1998-05-02 01:52:14 +00:00
|
|
|
cp.x = node[0] + ref->x;
|
|
|
|
cp.y = node[1] + ref->y;
|
|
|
|
cp.z = node[2] + ref->z;
|
1998-03-14 00:30:50 +00:00
|
|
|
|
1998-05-02 01:52:14 +00:00
|
|
|
pp = fgCartToPolar3d(cp);
|
1998-03-14 00:30:50 +00:00
|
|
|
|
1998-05-03 00:48:01 +00:00
|
|
|
pp.lon = fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.lon, 25.0);
|
|
|
|
pp.lat = fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.lat, 25.0);
|
1998-03-14 00:30:50 +00:00
|
|
|
|
1998-05-02 01:52:14 +00:00
|
|
|
return(pp);
|
1998-03-14 00:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// Load a .obj file and build the GL fragment list
|
1998-07-12 03:18:27 +00:00
|
|
|
int fgObjLoad(char *path, fgTILE *t) {
|
1998-05-23 14:09:20 +00:00
|
|
|
fgFRAGMENT fragment;
|
1998-07-08 14:47:20 +00:00
|
|
|
fgPoint3d pp;
|
1998-05-20 20:53:53 +00:00
|
|
|
char fgpath[256], line[256], material[256];
|
|
|
|
double approx_normal[3], normal[3], scale;
|
1998-04-27 03:30:13 +00:00
|
|
|
// double x, y, z, xmax, xmin, ymax, ymin, zmax, zmin;
|
1998-04-30 12:35:26 +00:00
|
|
|
// GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 };
|
1998-05-23 14:09:20 +00:00
|
|
|
GLint display_list;
|
1998-04-28 21:42:50 +00:00
|
|
|
fgFile f;
|
1998-07-13 21:00:09 +00:00
|
|
|
int shading;
|
1998-07-12 03:18:27 +00:00
|
|
|
int in_fragment, in_faces, vncount, n1, n2, n3, n4;
|
1997-12-15 23:54:25 +00:00
|
|
|
int last1, last2, odd;
|
1998-08-12 21:13:03 +00:00
|
|
|
double (*nodes)[3];
|
|
|
|
fgPoint3d *center;
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-06-05 18:19:18 +00:00
|
|
|
// First try "path.gz" (compressed format)
|
1998-04-28 21:42:50 +00:00
|
|
|
strcpy(fgpath, path);
|
1998-06-05 18:19:18 +00:00
|
|
|
strcat(fgpath, ".gz");
|
1998-04-28 21:42:50 +00:00
|
|
|
if ( (f = fgopen(fgpath, "rb")) == NULL ) {
|
1998-06-05 18:19:18 +00:00
|
|
|
// Next try "path" (uncompressed format)
|
1998-04-28 21:42:50 +00:00
|
|
|
strcpy(fgpath, path);
|
|
|
|
if ( (f = fgopen(fgpath, "rb")) == NULL ) {
|
1998-06-05 18:19:18 +00:00
|
|
|
// Next try "path.obj" (uncompressed format)
|
1998-04-28 21:42:50 +00:00
|
|
|
strcat(fgpath, ".gz");
|
|
|
|
if ( (f = fgopen(fgpath, "rb")) == NULL ) {
|
|
|
|
strcpy(fgpath, path);
|
|
|
|
fgPrintf( FG_TERRAIN, FG_ALERT,
|
|
|
|
"Cannot open file: %s\n", fgpath );
|
1998-05-23 14:09:20 +00:00
|
|
|
return(0);
|
1998-04-24 14:21:08 +00:00
|
|
|
}
|
1998-04-18 04:13:17 +00:00
|
|
|
}
|
1997-10-28 21:14:54 +00:00
|
|
|
}
|
|
|
|
|
1998-07-13 21:00:09 +00:00
|
|
|
shading = current_options.get_shading();
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
in_fragment = 0;
|
1998-07-12 03:18:27 +00:00
|
|
|
t->ncount = 1;
|
1997-11-14 00:26:49 +00:00
|
|
|
vncount = 1;
|
1998-07-12 03:18:27 +00:00
|
|
|
t->bounding_radius = 0.0;
|
1998-08-12 21:13:03 +00:00
|
|
|
nodes = t->nodes;
|
|
|
|
center = &t->center;
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-04-28 21:42:50 +00:00
|
|
|
while ( fggets(f, line, 250) != NULL ) {
|
1997-10-28 21:14:54 +00:00
|
|
|
if ( line[0] == '#' ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// comment -- ignore
|
1997-12-30 20:47:34 +00:00
|
|
|
} else if ( line[0] == '\n' ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// empty line -- ignore
|
|
|
|
} else if ( strncmp(line, "gbs ", 4) == 0 ) {
|
|
|
|
// reference point (center offset)
|
|
|
|
sscanf(line, "gbs %lf %lf %lf %lf\n",
|
1998-07-12 03:18:27 +00:00
|
|
|
&t->center.x, &t->center.y, &t->center.z,
|
|
|
|
&t->bounding_radius);
|
1998-05-24 02:49:09 +00:00
|
|
|
} else if ( strncmp(line, "bs ", 3) == 0 ) {
|
|
|
|
// reference point (center offset)
|
|
|
|
sscanf(line, "bs %lf %lf %lf %lf\n",
|
|
|
|
&fragment.center.x, &fragment.center.y, &fragment.center.z,
|
|
|
|
&fragment.bounding_radius);
|
1997-11-14 00:26:49 +00:00
|
|
|
} else if ( strncmp(line, "v ", 2) == 0 ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// node (vertex)
|
1998-07-12 03:18:27 +00:00
|
|
|
if ( t->ncount < MAX_NODES ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "vertex = %s", line);
|
1998-04-27 03:30:13 +00:00
|
|
|
sscanf(line, "v %lf %lf %lf\n",
|
1998-07-12 03:18:27 +00:00
|
|
|
&(t->nodes[t->ncount][0]), &(t->nodes[t->ncount][1]),
|
|
|
|
&(t->nodes[t->ncount][2]));
|
|
|
|
|
|
|
|
t->ncount++;
|
1998-01-29 00:51:38 +00:00
|
|
|
|
1997-10-28 21:14:54 +00:00
|
|
|
} else {
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_EXIT,
|
|
|
|
"Read too many nodes ... dying :-(\n");
|
1997-10-28 21:14:54 +00:00
|
|
|
}
|
1997-11-14 00:26:49 +00:00
|
|
|
} else if ( strncmp(line, "vn ", 3) == 0 ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// vertex normal
|
1998-07-12 03:18:27 +00:00
|
|
|
if ( vncount < MAX_NODES ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "vertex normal = %s", line);
|
1998-01-31 00:42:57 +00:00
|
|
|
sscanf(line, "vn %lf %lf %lf\n",
|
1997-11-14 00:26:49 +00:00
|
|
|
&normals[vncount][0], &normals[vncount][1],
|
|
|
|
&normals[vncount][2]);
|
|
|
|
vncount++;
|
|
|
|
} else {
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_EXIT,
|
|
|
|
"Read too many vertex normals ... dying :-(\n");
|
1997-11-14 00:26:49 +00:00
|
|
|
}
|
1998-05-20 20:53:53 +00:00
|
|
|
} else if ( strncmp(line, "usemtl ", 7) == 0 ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// material property specification
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// this also signals the start of a new fragment
|
|
|
|
if ( in_fragment ) {
|
|
|
|
// close out the previous structure and start the next
|
1997-12-15 23:54:25 +00:00
|
|
|
xglEnd();
|
1998-05-24 02:49:09 +00:00
|
|
|
xglEndList();
|
|
|
|
|
|
|
|
// update fragment
|
|
|
|
fragment.display_list = display_list;
|
|
|
|
|
|
|
|
// push this fragment onto the tile's object list
|
1998-07-12 03:18:27 +00:00
|
|
|
t->fragment_list.push_back(fragment);
|
1997-10-30 12:38:35 +00:00
|
|
|
} else {
|
1998-05-24 02:49:09 +00:00
|
|
|
in_fragment = 1;
|
1997-10-28 21:14:54 +00:00
|
|
|
}
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
display_list = xglGenLists(1);
|
|
|
|
xglNewList(display_list, GL_COMPILE);
|
|
|
|
in_faces = 0;
|
|
|
|
|
1998-07-12 03:18:27 +00:00
|
|
|
// reset the existing face list
|
|
|
|
// printf("cleaning a fragment with %d faces\n",
|
|
|
|
// fragment.faces.size());
|
|
|
|
while ( fragment.faces.size() ) {
|
|
|
|
// printf("emptying face list\n");
|
|
|
|
fragment.faces.pop_front();
|
|
|
|
}
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// scan the material line
|
|
|
|
sscanf(line, "usemtl %s\n", material);
|
1998-06-05 22:39:53 +00:00
|
|
|
|
1998-07-04 00:54:28 +00:00
|
|
|
// give the fragment a pointer back to the tile
|
1998-08-20 15:12:03 +00:00
|
|
|
fragment.tile_ptr = t;
|
1998-07-04 00:54:28 +00:00
|
|
|
|
1998-06-05 22:39:53 +00:00
|
|
|
// find this material in the properties list
|
|
|
|
map < string, fgMATERIAL, less<string> > :: iterator myfind =
|
|
|
|
material_mgr.material_map.find(material);
|
|
|
|
if ( myfind == material_mgr.material_map.end() ) {
|
|
|
|
fgPrintf( FG_TERRAIN, FG_ALERT,
|
|
|
|
"Ack! unknown usemtl name = %s in %s\n",
|
|
|
|
material, path);
|
|
|
|
} else {
|
1998-08-20 15:12:03 +00:00
|
|
|
fragment.material_ptr = &(*myfind).second;
|
1998-06-05 22:39:53 +00:00
|
|
|
}
|
|
|
|
|
1998-06-08 17:57:54 +00:00
|
|
|
// initialize the fragment transformation matrix
|
|
|
|
/*
|
|
|
|
for ( i = 0; i < 16; i++ ) {
|
|
|
|
fragment.matrix[i] = 0.0;
|
|
|
|
}
|
|
|
|
fragment.matrix[0] = fragment.matrix[5] =
|
|
|
|
fragment.matrix[10] = fragment.matrix[15] = 1.0;
|
|
|
|
*/
|
1998-08-12 21:13:03 +00:00
|
|
|
|
|
|
|
// initialize fragment face counter
|
|
|
|
fragment.num_faces = 0;
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
} else if ( line[0] == 't' ) {
|
|
|
|
// start a new triangle strip
|
|
|
|
|
|
|
|
n1 = n2 = n3 = n4 = 0;
|
|
|
|
|
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, " new tri strip = %s", line);
|
1997-10-31 04:49:12 +00:00
|
|
|
sscanf(line, "t %d %d %d %d\n", &n1, &n2, &n3, &n4);
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-07-12 03:18:27 +00:00
|
|
|
fragment.add_face(n1, n2, n3);
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "(t) = ");
|
1997-10-30 12:38:35 +00:00
|
|
|
|
1997-12-15 23:54:25 +00:00
|
|
|
xglBegin(GL_TRIANGLE_STRIP);
|
|
|
|
|
1998-05-20 20:53:53 +00:00
|
|
|
odd = 1;
|
|
|
|
scale = 1.0;
|
1997-12-15 23:54:25 +00:00
|
|
|
|
1998-07-13 21:00:09 +00:00
|
|
|
if ( shading ) {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_SMOOTH" so use precalculated
|
|
|
|
// (averaged) normals
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, normals[n1], scale);
|
|
|
|
xglNormal3dv(normal);
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n1], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n1][0],t->nodes[n1][1],t->nodes[n1][2]);
|
|
|
|
xglVertex3dv(nodes[n1]);
|
1997-12-08 22:51:17 +00:00
|
|
|
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, normals[n2], scale);
|
|
|
|
xglNormal3dv(normal);
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n2], center);
|
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
|
|
|
//xglVertex3d(t->nodes[n2][0],t->nodes[n2][1],t->nodes[n2][2]);
|
|
|
|
xglVertex3dv(nodes[n2]);
|
1997-11-14 00:26:49 +00:00
|
|
|
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, normals[n3], scale);
|
|
|
|
xglNormal3dv(normal);
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n3], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n3][0],t->nodes[n3][1],t->nodes[n3][2]);
|
|
|
|
xglVertex3dv(nodes[n3]);
|
1997-12-30 01:38:37 +00:00
|
|
|
} else {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_FLAT" so calculate per face
|
|
|
|
// normals on the fly.
|
1997-12-30 01:38:37 +00:00
|
|
|
if ( odd ) {
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[n1], nodes[n2],
|
|
|
|
nodes[n3], approx_normal);
|
1997-12-30 01:38:37 +00:00
|
|
|
} else {
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[n2], nodes[n1],
|
|
|
|
nodes[n3], approx_normal);
|
1997-12-30 01:38:37 +00:00
|
|
|
}
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, approx_normal, scale);
|
|
|
|
xglNormal3dv(normal);
|
1997-11-14 00:26:49 +00:00
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n1], center);
|
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
|
|
|
// xglVertex3d(t->nodes[n1][0],t->nodes[n1][1],t->nodes[n1][2]);
|
|
|
|
xglVertex3dv(nodes[n1]);
|
1998-05-02 01:52:14 +00:00
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n2], center);
|
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
|
|
|
// xglVertex3d(t->nodes[n2][0],t->nodes[n2][1],t->nodes[n2][2]);
|
|
|
|
xglVertex3dv(nodes[n2]);
|
1998-05-02 01:52:14 +00:00
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n3], center);
|
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
|
|
|
// xglVertex3d(t->nodes[n3][0],t->nodes[n3][1],t->nodes[n3][2]);
|
|
|
|
xglVertex3dv(nodes[n3]);
|
1997-12-30 01:38:37 +00:00
|
|
|
}
|
1997-12-15 23:54:25 +00:00
|
|
|
|
|
|
|
odd = 1 - odd;
|
|
|
|
last1 = n2;
|
|
|
|
last2 = n3;
|
1997-10-31 04:49:12 +00:00
|
|
|
|
1997-10-30 12:38:35 +00:00
|
|
|
if ( n4 > 0 ) {
|
1998-07-12 03:18:27 +00:00
|
|
|
fragment.add_face(n3, n2, n4);
|
|
|
|
|
1998-07-13 21:00:09 +00:00
|
|
|
if ( shading ) {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_SMOOTH"
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, normals[n4], scale);
|
1997-12-15 23:54:25 +00:00
|
|
|
} else {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_FLAT"
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[n3], nodes[n2], nodes[n4],
|
1998-07-12 03:18:27 +00:00
|
|
|
approx_normal);
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, approx_normal, scale);
|
1997-12-15 23:54:25 +00:00
|
|
|
}
|
1997-12-30 23:09:40 +00:00
|
|
|
xglNormal3dv(normal);
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n4], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n4][0],t->nodes[n4][1],t->nodes[n4][2]);
|
|
|
|
xglVertex3dv(nodes[n4]);
|
1997-12-15 23:54:25 +00:00
|
|
|
|
|
|
|
odd = 1 - odd;
|
|
|
|
last1 = n3;
|
|
|
|
last2 = n4;
|
1997-10-30 12:38:35 +00:00
|
|
|
}
|
1997-11-14 00:26:49 +00:00
|
|
|
} else if ( line[0] == 'f' ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// unoptimized face
|
1997-11-14 00:26:49 +00:00
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
if ( !in_faces ) {
|
|
|
|
xglBegin(GL_TRIANGLES);
|
|
|
|
in_faces = 1;
|
1997-11-14 00:26:49 +00:00
|
|
|
}
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "new triangle = %s", line);*/
|
1997-11-14 00:26:49 +00:00
|
|
|
sscanf(line, "f %d %d %d\n", &n1, &n2, &n3);
|
|
|
|
|
1998-07-12 03:18:27 +00:00
|
|
|
fragment.add_face(n1, n2, n3);
|
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
|
|
|
|
xglNormal3dv(normals[n1]);
|
|
|
|
pp = calc_tex_coords(nodes[n1], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n1][0], t->nodes[n1][1], t->nodes[n1][2]);
|
|
|
|
xglVertex3dv(nodes[n1]);
|
1997-11-14 00:26:49 +00:00
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);
|
|
|
|
xglNormal3dv(normals[n2]);
|
|
|
|
pp = calc_tex_coords(nodes[n2], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n2][0], t->nodes[n2][1], t->nodes[n2][2]);
|
|
|
|
xglVertex3dv(nodes[n2]);
|
1998-03-14 00:30:50 +00:00
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglNormal3d(normals[n3][0], normals[n3][1], normals[n3][2]);
|
|
|
|
xglNormal3dv(normals[n3]);
|
|
|
|
pp = calc_tex_coords(nodes[n3], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n3][0], t->nodes[n3][1], t->nodes[n3][2]);
|
|
|
|
xglVertex3dv(nodes[n3]);
|
1997-10-28 21:14:54 +00:00
|
|
|
} else if ( line[0] == 'q' ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// continue a triangle strip
|
1997-10-28 21:14:54 +00:00
|
|
|
n1 = n2 = 0;
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "continued tri strip = %s ",
|
|
|
|
// line);
|
1997-10-28 21:14:54 +00:00
|
|
|
sscanf(line, "q %d %d\n", &n1, &n2);
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, "read %d %d\n", n1, n2);
|
1997-10-30 12:38:35 +00:00
|
|
|
|
1998-07-12 03:18:27 +00:00
|
|
|
if ( odd ) {
|
|
|
|
fragment.add_face(last1, last2, n1);
|
|
|
|
} else {
|
|
|
|
fragment.add_face(last2, last1, n1);
|
|
|
|
}
|
|
|
|
|
1998-07-13 21:00:09 +00:00
|
|
|
if ( shading ) {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_SMOOTH"
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, normals[n1], scale);
|
|
|
|
xglNormal3dv(normal);
|
1997-12-15 23:54:25 +00:00
|
|
|
} else {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_FLAT"
|
1997-12-30 01:38:37 +00:00
|
|
|
if ( odd ) {
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[last1], nodes[last2], nodes[n1],
|
1997-12-30 01:38:37 +00:00
|
|
|
approx_normal);
|
|
|
|
} else {
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[last2], nodes[last1], nodes[n1],
|
1997-12-30 01:38:37 +00:00
|
|
|
approx_normal);
|
|
|
|
}
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, approx_normal, scale);
|
|
|
|
xglNormal3dv(normal);
|
1997-12-15 23:54:25 +00:00
|
|
|
}
|
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n1], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n1][0], t->nodes[n1][1], t->nodes[n1][2]);
|
|
|
|
xglVertex3dv(nodes[n1]);
|
1998-03-14 00:30:50 +00:00
|
|
|
|
1997-12-15 23:54:25 +00:00
|
|
|
odd = 1 - odd;
|
|
|
|
last1 = last2;
|
|
|
|
last2 = n1;
|
1997-10-31 04:49:12 +00:00
|
|
|
|
1997-10-30 12:38:35 +00:00
|
|
|
if ( n2 > 0 ) {
|
1998-05-24 02:49:09 +00:00
|
|
|
// fgPrintf( FG_TERRAIN, FG_DEBUG, " (cont)\n");
|
1997-12-30 01:38:37 +00:00
|
|
|
|
1998-07-12 03:18:27 +00:00
|
|
|
if ( odd ) {
|
|
|
|
fragment.add_face(last1, last2, n2);
|
|
|
|
} else {
|
|
|
|
fragment.add_face(last2, last1, n2);
|
|
|
|
}
|
|
|
|
|
1998-07-13 21:00:09 +00:00
|
|
|
if ( shading ) {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_SMOOTH"
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, normals[n2], scale);
|
|
|
|
xglNormal3dv(normal);
|
1997-12-15 23:54:25 +00:00
|
|
|
} else {
|
1998-04-30 12:35:26 +00:00
|
|
|
// Shading model is "GL_FLAT"
|
1997-12-30 01:38:37 +00:00
|
|
|
if ( odd ) {
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[last1], nodes[last2],
|
|
|
|
nodes[n2], approx_normal);
|
1997-12-30 01:38:37 +00:00
|
|
|
} else {
|
1998-08-12 21:13:03 +00:00
|
|
|
calc_normal(nodes[last2], nodes[last1],
|
|
|
|
nodes[n2], approx_normal);
|
1997-12-30 01:38:37 +00:00
|
|
|
}
|
1997-12-30 23:09:40 +00:00
|
|
|
MAT3_SCALE_VEC(normal, approx_normal, scale);
|
|
|
|
xglNormal3dv(normal);
|
1997-12-15 23:54:25 +00:00
|
|
|
}
|
|
|
|
|
1998-08-12 21:13:03 +00:00
|
|
|
pp = calc_tex_coords(nodes[n2], center);
|
1998-05-02 01:52:14 +00:00
|
|
|
xglTexCoord2f(pp.lon, pp.lat);
|
1998-08-12 21:13:03 +00:00
|
|
|
// xglVertex3d(t->nodes[n2][0],t->nodes[n2][1],t->nodes[n2][2]);
|
|
|
|
xglVertex3dv(nodes[n2]);
|
1997-12-15 23:54:25 +00:00
|
|
|
|
|
|
|
odd = 1 -odd;
|
|
|
|
last1 = last2;
|
|
|
|
last2 = n2;
|
1997-10-30 12:38:35 +00:00
|
|
|
}
|
1997-10-28 21:14:54 +00:00
|
|
|
} else {
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_WARN, "Unknown line in %s = %s\n",
|
|
|
|
path, line);
|
1997-10-28 21:14:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
if ( in_fragment ) {
|
|
|
|
// close out the previous structure and start the next
|
|
|
|
xglEnd();
|
|
|
|
xglEndList();
|
|
|
|
|
|
|
|
// update fragment
|
|
|
|
fragment.display_list = display_list;
|
|
|
|
|
|
|
|
// push this fragment onto the tile's object list
|
1998-07-12 03:18:27 +00:00
|
|
|
t->fragment_list.push_back(fragment);
|
1998-05-24 02:49:09 +00:00
|
|
|
}
|
1997-12-08 22:51:17 +00:00
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// Draw normal vectors (for visually verifying normals)
|
1997-12-10 01:19:42 +00:00
|
|
|
/*
|
1997-12-15 23:54:25 +00:00
|
|
|
xglBegin(GL_LINES);
|
|
|
|
xglColor3f(0.0, 0.0, 0.0);
|
1998-07-12 03:18:27 +00:00
|
|
|
for ( i = 0; i < t->ncount; i++ ) {
|
|
|
|
xglVertex3d(t->nodes[i][0],
|
|
|
|
t->nodes[i][1] ,
|
|
|
|
t->nodes[i][2]);
|
|
|
|
xglVertex3d(t->nodes[i][0] + 500*normals[i][0],
|
|
|
|
t->nodes[i][1] + 500*normals[i][1],
|
|
|
|
t->nodes[i][2] + 500*normals[i][2]);
|
1997-12-10 01:19:42 +00:00
|
|
|
}
|
1997-12-15 23:54:25 +00:00
|
|
|
xglEnd();
|
1998-05-24 02:49:09 +00:00
|
|
|
*/
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-04-28 21:42:50 +00:00
|
|
|
fgclose(f);
|
1997-10-28 21:14:54 +00:00
|
|
|
|
1998-05-23 14:09:20 +00:00
|
|
|
return(1);
|
1997-10-28 21:14:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-24 02:49:09 +00:00
|
|
|
// $Log$
|
1998-08-20 15:12:03 +00:00
|
|
|
// Revision 1.22 1998/08/20 15:12:03 curt
|
|
|
|
// Used a forward declaration of classes fgTILE and fgMATERIAL to eliminate
|
|
|
|
// the need for "void" pointers and casts.
|
|
|
|
// Quick hack to count the number of scenery polygons that are being drawn.
|
|
|
|
//
|
1998-08-12 21:13:03 +00:00
|
|
|
// Revision 1.21 1998/08/12 21:13:04 curt
|
|
|
|
// material.cxx: don't load textures if they are disabled
|
|
|
|
// obj.cxx: optimizations from Norman Vine
|
|
|
|
// tile.cxx: minor tweaks
|
|
|
|
// tile.hxx: addition of num_faces
|
|
|
|
// tilemgr.cxx: minor tweaks
|
|
|
|
//
|
1998-07-24 21:42:06 +00:00
|
|
|
// Revision 1.20 1998/07/24 21:42:07 curt
|
|
|
|
// material.cxx: whups, double method declaration with no definition.
|
|
|
|
// obj.cxx: tweaks to avoid errors in SGI's CC.
|
|
|
|
// tile.cxx: optimizations by Norman Vine.
|
|
|
|
// tilemgr.cxx: optimizations by Norman Vine.
|
|
|
|
//
|
1998-07-13 21:00:09 +00:00
|
|
|
// Revision 1.19 1998/07/13 21:01:58 curt
|
|
|
|
// Wrote access functions for current fgOPTIONS.
|
|
|
|
//
|
1998-07-12 03:18:27 +00:00
|
|
|
// Revision 1.18 1998/07/12 03:18:27 curt
|
|
|
|
// Added ground collision detection. This involved:
|
|
|
|
// - saving the entire vertex list for each tile with the tile records.
|
|
|
|
// - saving the face list for each fragment with the fragment records.
|
|
|
|
// - code to intersect the current vertical line with the proper face in
|
|
|
|
// an efficient manner as possible.
|
|
|
|
// Fixed a bug where the tiles weren't being shifted to "near" (0,0,0)
|
|
|
|
//
|
1998-07-08 14:47:20 +00:00
|
|
|
// Revision 1.17 1998/07/08 14:47:21 curt
|
|
|
|
// Fix GL_MODULATE vs. GL_DECAL problem introduced by splash screen.
|
|
|
|
// polare3d.h renamed to polar3d.hxx
|
|
|
|
// fg{Cartesian,Polar}Point3d consolodated.
|
|
|
|
// Added some initial support for calculating local current ground elevation.
|
|
|
|
//
|
1998-07-06 21:34:33 +00:00
|
|
|
// Revision 1.16 1998/07/06 21:34:33 curt
|
|
|
|
// Added using namespace std for compilers that support this.
|
|
|
|
//
|
1998-07-04 00:54:28 +00:00
|
|
|
// Revision 1.15 1998/07/04 00:54:28 curt
|
|
|
|
// Added automatic mipmap generation.
|
|
|
|
//
|
|
|
|
// When rendering fragments, use saved model view matrix from associated tile
|
|
|
|
// rather than recalculating it with push() translate() pop().
|
|
|
|
//
|
1998-06-17 21:36:39 +00:00
|
|
|
// Revision 1.14 1998/06/17 21:36:40 curt
|
|
|
|
// Load and manage multiple textures defined in the Materials library.
|
|
|
|
// Boost max material fagments for each material property to 800.
|
|
|
|
// Multiple texture support when rendering.
|
|
|
|
//
|
1998-06-12 00:55:58 +00:00
|
|
|
// Revision 1.13 1998/06/12 00:58:05 curt
|
|
|
|
// Build only static libraries.
|
|
|
|
// Declare memmove/memset for Sloaris.
|
|
|
|
//
|
1998-06-08 17:57:54 +00:00
|
|
|
// Revision 1.12 1998/06/08 17:57:54 curt
|
|
|
|
// Working first pass at material proporty sorting.
|
|
|
|
//
|
1998-06-06 01:09:31 +00:00
|
|
|
// Revision 1.11 1998/06/06 01:09:31 curt
|
|
|
|
// I goofed on the log message in the last commit ... now fixed.
|
|
|
|
//
|
1998-06-06 01:07:17 +00:00
|
|
|
// Revision 1.10 1998/06/06 01:07:17 curt
|
|
|
|
// Increased per material fragment list size from 100 to 400.
|
1998-06-06 01:09:31 +00:00
|
|
|
// Now correctly draw viewable fragments in per material order.
|
1998-06-06 01:07:17 +00:00
|
|
|
//
|
1998-06-05 22:39:53 +00:00
|
|
|
// Revision 1.9 1998/06/05 22:39:54 curt
|
|
|
|
// Working on sorting by, and rendering by material properties.
|
|
|
|
//
|
1998-06-05 18:19:18 +00:00
|
|
|
// Revision 1.8 1998/06/05 18:19:18 curt
|
|
|
|
// Recognize file, file.gz, and file.obj as scenery object files.
|
|
|
|
//
|
1998-05-24 02:49:09 +00:00
|
|
|
// Revision 1.7 1998/05/24 02:49:09 curt
|
|
|
|
// Implimented fragment level view frustum culling.
|
|
|
|
//
|
|
|
|
// Revision 1.6 1998/05/23 14:09:20 curt
|
|
|
|
// Added tile.cxx and tile.hxx.
|
|
|
|
// Working on rewriting the tile management system so a tile is just a list
|
|
|
|
// fragments, and the fragment record contains the display list for that
|
|
|
|
// fragment.
|
|
|
|
//
|
|
|
|
// Revision 1.5 1998/05/20 20:53:53 curt
|
|
|
|
// Moved global ref point and radius (bounding sphere info, and offset) to
|
|
|
|
// data file rather than calculating it on the fly.
|
|
|
|
// Fixed polygon winding problem in scenery generation stage rather than
|
|
|
|
// compensating for it on the fly.
|
|
|
|
// Made a fgTILECACHE class.
|
|
|
|
//
|
|
|
|
// Revision 1.4 1998/05/16 13:09:57 curt
|
|
|
|
// Beginning to add support for view frustum culling.
|
|
|
|
// Added some temporary code to calculate bouding radius, until the
|
|
|
|
// scenery generation tools and scenery can be updated.
|
|
|
|
//
|
|
|
|
// Revision 1.3 1998/05/03 00:48:01 curt
|
|
|
|
// Updated texture coordinate fmod() parameter.
|
|
|
|
//
|
|
|
|
// Revision 1.2 1998/05/02 01:52:14 curt
|
|
|
|
// Playing around with texture coordinates.
|
|
|
|
//
|
|
|
|
// Revision 1.1 1998/04/30 12:35:28 curt
|
|
|
|
// Added a command line rendering option specify smooth/flat shading.
|
|
|
|
//
|
|
|
|
// Revision 1.35 1998/04/28 21:43:26 curt
|
|
|
|
// Wrapped zlib calls up so we can conditionally comment out zlib support.
|
|
|
|
//
|
|
|
|
// Revision 1.34 1998/04/28 01:21:42 curt
|
|
|
|
// Tweaked texture parameter calculations to keep the number smaller. This
|
|
|
|
// avoids the "swimming" problem.
|
|
|
|
// Type-ified fgTIME and fgVIEW.
|
|
|
|
//
|
|
|
|
// Revision 1.33 1998/04/27 15:58:15 curt
|
|
|
|
// Screwing around with texture coordinate generation ... still needs work.
|
|
|
|
//
|
|
|
|
// Revision 1.32 1998/04/27 03:30:13 curt
|
|
|
|
// Minor transformation adjustments to try to keep scenery tiles closer to
|
|
|
|
// (0, 0, 0) GLfloats run out of precision at the distances we need to model
|
|
|
|
// the earth, but we can do a bunch of pre-transformations using double math
|
|
|
|
// and then cast to GLfloat once everything is close in where we have less
|
|
|
|
// precision problems.
|
|
|
|
//
|
|
|
|
// Revision 1.31 1998/04/25 15:09:57 curt
|
|
|
|
// Changed "r" to "rb" in gzopen() options. This fixes bad behavior in win32.
|
|
|
|
//
|
|
|
|
// Revision 1.30 1998/04/24 14:21:08 curt
|
|
|
|
// Added "file.obj.gz" support.
|
|
|
|
//
|
|
|
|
// Revision 1.29 1998/04/24 00:51:07 curt
|
|
|
|
// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
|
|
|
|
// Tweaked the scenery file extentions to be "file.obj" (uncompressed)
|
|
|
|
// or "file.obz" (compressed.)
|
|
|
|
//
|
|
|
|
// Revision 1.28 1998/04/22 13:22:44 curt
|
|
|
|
// C++ - ifing the code a bit.
|
|
|
|
//
|
|
|
|
// Revision 1.27 1998/04/18 04:13:17 curt
|
|
|
|
// Added zlib on the fly decompression support for loading scenery objects.
|
|
|
|
//
|
|
|
|
// Revision 1.26 1998/04/03 22:11:36 curt
|
|
|
|
// Converting to Gnu autoconf system.
|
|
|
|
//
|
|
|
|
// Revision 1.25 1998/03/14 00:30:50 curt
|
|
|
|
// Beginning initial terrain texturing experiments.
|
|
|
|
//
|
|
|
|
// Revision 1.24 1998/02/09 21:30:18 curt
|
|
|
|
// Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
|
|
|
|
//
|
|
|
|
// Revision 1.23 1998/02/09 15:07:52 curt
|
|
|
|
// Minor tweaks.
|
|
|
|
//
|
|
|
|
// Revision 1.22 1998/02/01 03:39:54 curt
|
|
|
|
// Minor tweaks.
|
|
|
|
//
|
|
|
|
// Revision 1.21 1998/01/31 00:43:25 curt
|
|
|
|
// Added MetroWorks patches from Carmen Volpe.
|
|
|
|
//
|
|
|
|
// Revision 1.20 1998/01/29 00:51:39 curt
|
|
|
|
// First pass at tile cache, dynamic tile loading and tile unloading now works.
|
|
|
|
//
|
|
|
|
// Revision 1.19 1998/01/27 03:26:42 curt
|
|
|
|
// Playing with new fgPrintf command.
|
|
|
|
//
|
|
|
|
// Revision 1.18 1998/01/19 19:27:16 curt
|
|
|
|
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
|
|
|
// This should simplify things tremendously.
|
|
|
|
//
|
|
|
|
// Revision 1.17 1998/01/13 00:23:10 curt
|
|
|
|
// Initial changes to support loading and management of scenery tiles. Note,
|
|
|
|
// there's still a fair amount of work left to be done.
|
|
|
|
//
|
|
|
|
// Revision 1.16 1997/12/30 23:09:40 curt
|
|
|
|
// Worked on winding problem without luck, so back to calling glFrontFace()
|
|
|
|
// 3 times for each scenery area.
|
|
|
|
//
|
|
|
|
// Revision 1.15 1997/12/30 20:47:51 curt
|
|
|
|
// Integrated new event manager with subsystem initializations.
|
|
|
|
//
|
|
|
|
// Revision 1.14 1997/12/30 01:38:46 curt
|
|
|
|
// Switched back to per vertex normals and smooth shading for terrain.
|
|
|
|
//
|
|
|
|
// Revision 1.13 1997/12/18 23:32:36 curt
|
|
|
|
// First stab at sky dome actually starting to look reasonable. :-)
|
|
|
|
//
|
|
|
|
// Revision 1.12 1997/12/17 23:13:47 curt
|
|
|
|
// Began working on rendering the sky.
|
|
|
|
//
|
|
|
|
// Revision 1.11 1997/12/15 23:55:01 curt
|
|
|
|
// Add xgl wrappers for debugging.
|
|
|
|
// Generate terrain normals on the fly.
|
|
|
|
//
|
|
|
|
// Revision 1.10 1997/12/12 21:41:28 curt
|
|
|
|
// More light/material property tweaking ... still a ways off.
|
|
|
|
//
|
|
|
|
// Revision 1.9 1997/12/12 19:52:57 curt
|
|
|
|
// Working on lightling and material properties.
|
|
|
|
//
|
|
|
|
// Revision 1.8 1997/12/10 01:19:51 curt
|
|
|
|
// Tweaks for verion 0.15 release.
|
|
|
|
//
|
|
|
|
// Revision 1.7 1997/12/08 22:51:17 curt
|
|
|
|
// Enhanced to handle ccw and cw tri-stripe winding. This is a temporary
|
|
|
|
// admission of defeat. I will eventually go back and get all the stripes
|
|
|
|
// wound the same way (ccw).
|
|
|
|
//
|
|
|
|
// Revision 1.6 1997/11/25 19:25:35 curt
|
|
|
|
// Changes to integrate Durk's moon/sun code updates + clean up.
|
|
|
|
//
|
|
|
|
// Revision 1.5 1997/11/15 18:16:39 curt
|
|
|
|
// minor tweaks.
|
|
|
|
//
|
|
|
|
// Revision 1.4 1997/11/14 00:26:49 curt
|
|
|
|
// Transform scenery coordinates earlier in pipeline when scenery is being
|
|
|
|
// created, not when it is being loaded. Precalculate normals for each node
|
|
|
|
// as average of the normals of each containing polygon so Garoude shading is
|
|
|
|
// now supportable.
|
|
|
|
//
|
|
|
|
// Revision 1.3 1997/10/31 04:49:12 curt
|
|
|
|
// Tweaking vertex orders.
|
|
|
|
//
|
|
|
|
// Revision 1.2 1997/10/30 12:38:45 curt
|
|
|
|
// Working on new scenery subsystem.
|
|
|
|
//
|
|
|
|
// Revision 1.1 1997/10/28 21:14:54 curt
|
|
|
|
// Initial revision.
|
|
|
|
|
|
|
|
|