1
0
Fork 0

Made a few changes converting floats to doubles.

This commit is contained in:
curt 1998-01-31 00:41:19 +00:00
parent f389ae86de
commit 2b1b396ef5
7 changed files with 55 additions and 30 deletions

View file

@ -41,7 +41,7 @@
int nodecount = 0;
float nodes[MAX_NODES][3];
double nodes[MAX_NODES][3];
struct fgBUCKET my_index;
@ -315,7 +315,7 @@ void read_nodes(FILE *fp) {
while ( fgets(line, 250, fp) != NULL ) {
if ( strncmp(line, "gdn ", 4) == 0 ) {
sscanf(line, "gdn %f %f %f\n", &nodes[nodecount][0],
sscanf(line, "gdn %lf %lf %lf\n", &nodes[nodecount][0],
&nodes[nodecount][1], &nodes[nodecount][2]);
/*
printf("read_nodes(%d) %.2f %.2f %.2f %s", nodecount,
@ -454,9 +454,12 @@ int main(int argc, char **argv) {
/* $Log$
/* Revision 1.3 1998/01/27 18:37:00 curt
/* Lots of updates to get back in sync with changes made over in .../Src/
/* Revision 1.4 1998/01/31 00:41:23 curt
/* Made a few changes converting floats to doubles.
/*
* Revision 1.3 1998/01/27 18:37:00 curt
* Lots of updates to get back in sync with changes made over in .../Src/
*
* Revision 1.2 1998/01/15 21:33:36 curt
* Assembling triangles and building a new .node file with the proper shared
* vertices now works. Now we just have to use the shared normals and we'll

View file

@ -33,8 +33,8 @@
/* what do ya' know, here's some global variables */
float nodes[MAXNODES][3];
float normals[MAXNODES][3];
double nodes[MAXNODES][3];
double normals[MAXNODES][3];
int ccw_list[MAXNODES];
int ccw_list_ptr;
@ -175,7 +175,7 @@ void obj_fix(char *infile, char *outfile) {
/* save vertex to memory and output to file */
if ( ncount < MAXNODES ) {
/* printf("vertex = %s", line); */
sscanf(line, "v %f %f %f\n",
sscanf(line, "v %lf %lf %lf\n",
&nodes[ncount][0], &nodes[ncount][1], &nodes[ncount][2]);
fprintf(out, "v %.2f %.2f %.2f\n",
nodes[ncount][0], nodes[ncount][1], nodes[ncount][2]);
@ -188,7 +188,7 @@ void obj_fix(char *infile, char *outfile) {
/* save vertex normals to memory and output to file */
if ( vncount < MAXNODES ) {
/* printf("vertex normal = %s", line); */
sscanf(line, "vn %f %f %f\n",
sscanf(line, "vn %lf %lf %lf\n",
&normals[vncount][0], &normals[vncount][1],
&normals[vncount][2]);
fprintf(out, "vn %.4f %.4f %.4f\n", normals[vncount][0],
@ -288,9 +288,12 @@ void obj_fix(char *infile, char *outfile) {
/* $Log$
/* Revision 1.3 1998/01/19 19:51:07 curt
/* A couple final pre-release tweaks.
/* Revision 1.4 1998/01/31 00:41:25 curt
/* Made a few changes converting floats to doubles.
/*
* Revision 1.3 1998/01/19 19:51:07 curt
* A couple final pre-release tweaks.
*
* Revision 1.2 1998/01/09 23:03:12 curt
* Restructured to split 1deg x 1deg dem's into 64 subsections.
*

View file

@ -30,8 +30,8 @@
#define MAXNODES 100000
extern float nodes[MAXNODES][3];
extern float normals[MAXNODES][3];
extern double nodes[MAXNODES][3];
extern double normals[MAXNODES][3];
extern int stack[MAXNODES];
@ -43,9 +43,12 @@ void obj_fix(char *infile, char *outfile);
/* $Log$
/* Revision 1.2 1998/01/09 23:03:13 curt
/* Restructured to split 1deg x 1deg dem's into 64 subsections.
/* Revision 1.3 1998/01/31 00:41:25 curt
/* Made a few changes converting floats to doubles.
/*
* Revision 1.2 1998/01/09 23:03:13 curt
* Restructured to split 1deg x 1deg dem's into 64 subsections.
*
* Revision 1.1 1997/12/08 19:28:55 curt
* Initial revision.
*

View file

@ -82,7 +82,7 @@ void calc_normal(struct fgCartesianPoint p1, struct fgCartesianPoint p2,
struct fgCartesianPoint p3, double normal[3])
{
double v1[3], v2[3];
float temp;
double temp;
v1[0] = p2.x - p1.x; v1[1] = p2.y - p1.y; v1[2] = p2.z - p1.z;
v2[0] = p3.x - p1.x; v2[1] = p3.y - p1.y; v2[2] = p3.z - p1.z;
@ -609,9 +609,12 @@ int main(int argc, char **argv) {
/* $Log$
/* Revision 1.3 1998/01/27 18:37:04 curt
/* Lots of updates to get back in sync with changes made over in .../Src/
/* Revision 1.4 1998/01/31 00:41:26 curt
/* Made a few changes converting floats to doubles.
/*
* Revision 1.3 1998/01/27 18:37:04 curt
* Lots of updates to get back in sync with changes made over in .../Src/
*
* Revision 1.2 1998/01/14 15:54:43 curt
* Initial revision completed.
*

View file

@ -60,16 +60,16 @@ clean:
source-tar: clean
(cd ..; \
tar cvzf demtools-$(FG_VERSION).tar.gz Tools/Makefile Tools/README \
Tools/Todo Tools/make.inc Tools/AssemTris Tools/Dem2node \
Tools/FixNode Tools/FixObj Tools/SplitTris Tools/Stripe_u \
Tools/Tri2obj Tools/Triangle)
Tools/Todo Tools/make.inc Tools/process-dem.pl Tools/AssemTris \
Tools/Dem2node Tools/FixNode Tools/FixObj Tools/SplitTris \
Tools/Stripe_u Tools/Tri2obj Tools/Triangle)
source-zip: clean
(cd ..; \
zip -r demtools-$(FG_VERSION).zip Tools/Makefile Tools/README \
Tools/Todo Tools/make.inc Tools/AssemTris Tools/Dem2node \
Tools/FixNode Tools/FixObj Tools/SplitTris Tools/Stripe_u \
Tools/Tri2obj Tools/Triangle)
Tools/Todo Tools/make.inc Tools/process-dem.pl Tools/AssemTris \
Tools/Dem2node Tools/FixNode Tools/FixObj Tools/SplitTris \
Tools/Stripe_u Tools/Tri2obj Tools/Triangle)
bin-tar: all
echo "need to fix this"
@ -89,6 +89,9 @@ bin-zip:
#---------------------------------------------------------------------------
# $Log$
# Revision 1.8 1998/01/31 00:41:19 curt
# Made a few changes converting floats to doubles.
#
# Revision 1.7 1998/01/27 18:36:53 curt
# Lots of updates to get back in sync with changes made over in .../Src/
#

View file

@ -20,6 +20,11 @@
1/12/98 - Try reversing cw-wound strips rather than calling glFrontFace()
in the display list.
gnuplot> set label "1" at 1,1
gnuplot> set label "2" at 2,2
gnuplot> plot x
1/21/98 - Generate an elevation quad tree.
1/12/98 - Generate a face adjacency matrix

View file

@ -46,7 +46,7 @@ struct fgCartesianPoint nodes[MAX_NODES];
int tris[MAX_TRIS][3];
int new_tris[MAX_TRIS][3];
float normals[MAX_NODES][3];
double normals[MAX_NODES][3];
struct fgBUCKET my_index;
struct fgBUCKET ne_index, nw_index, sw_index, se_index;
@ -80,13 +80,13 @@ void calc_normal(struct fgCartesianPoint p1, struct fgCartesianPoint p2,
struct fgCartesianPoint p3, double normal[3])
{
double v1[3], v2[3];
float temp;
double temp;
v1[0] = p2.x - p1.x; v1[1] = p2.y - p1.y; v1[2] = p2.z - p1.z;
v2[0] = p3.x - p1.x; v2[1] = p3.y - p1.y; v2[2] = p3.z - p1.z;
MAT3cross_product(normal, v1, v2);
MAT3_NORMALIZE_VEC(normal,temp);
MAT3_NORMALIZE_VEC(normal, temp);
/* printf(" Normal = %.2f %.2f %.2f\n", normal[0], normal[1], normal[2]); */
}
@ -363,8 +363,10 @@ void read_normals(FILE *fp) {
while ( fgets(line, 250, fp) != NULL ) {
if ( strncmp(line, "vn ", 3) == 0 ) {
sscanf(line, "vn %f %f %f\n", &normals[normalcount][0],
&normals[normalcount][1], &normals[normalcount][2]);
sscanf( line, "vn %lf %lf %lf\n",
&normals[normalcount][0],
&normals[normalcount][1],
&normals[normalcount][2] );
/*
printf("read_normals(%d) %.2f %.2f %.2f %s", normalcount,
normals[normalcount][0], normals[normalcount][1],
@ -638,9 +640,12 @@ int main(int argc, char **argv) {
/* $Log$
/* Revision 1.9 1998/01/27 18:37:04 curt
/* Lots of updates to get back in sync with changes made over in .../Src/
/* Revision 1.10 1998/01/31 00:41:27 curt
/* Made a few changes converting floats to doubles.
/*
* Revision 1.9 1998/01/27 18:37:04 curt
* Lots of updates to get back in sync with changes made over in .../Src/
*
* Revision 1.8 1998/01/17 01:25:39 curt
* Added support for shared normals.
*