Skip to content

Commit

Permalink
ray4: deprecate r4_globals.h
Browse files Browse the repository at this point in the history
All global variables now defined/declared in ray4.h.

Resolves #28
  • Loading branch information
hollasch committed Oct 25, 2024
1 parent c1eb3ff commit adf7ec3
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 74 deletions.
1 change: 0 additions & 1 deletion ray4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ project (ray4 LANGUAGES CXX)
# Source
set ( sources_ray4
src/ray4.h
src/r4_globals.h
src/r4_image.h
src/r4_vector.h
src/r4_hit.cpp
Expand Down
68 changes: 0 additions & 68 deletions ray4/src/r4_globals.h

This file was deleted.

1 change: 0 additions & 1 deletion ray4/src/r4_hit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <stdio.h>

#include "ray4.h"
#include "r4_globals.h"


#define MINDIST 1e-7 // Minimum Intersection Distance (for the elimination of surface acne)
Expand Down
1 change: 0 additions & 1 deletion ray4/src/r4_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <fcntl.h>

#include "ray4.h"
#include "r4_globals.h"


/*** Local Global Variables ***/
Expand Down
1 change: 0 additions & 1 deletion ray4/src/r4_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#define DEFINE_GLOBALS
#include "ray4.h"
#include "r4_globals.h"
#include "r4_image.h"


Expand Down
1 change: 0 additions & 1 deletion ray4/src/r4_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <stdarg.h>

#include "ray4.h"
#include "r4_globals.h"

int EOFC= -1;

Expand Down
1 change: 0 additions & 1 deletion ray4/src/r4_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
//==================================================================================================

#include "ray4.h"
#include "r4_globals.h"

Color black = { 0.000, 0.000, 0.000 }; // Used to zero out colors.

Expand Down
37 changes: 37 additions & 0 deletions ray4/src/ray4.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,41 @@ int ReadChar (void);
void UnreadChar (int);
void WriteBlock (void *block, int size);


// Global Variables

#ifdef DEFINE_GLOBALS
Color ambient = { .0, .0, .0 }; // Ambient Light Factor
Attributes *attrlist = nullptr; // Attributes List
Color background = { .0, .0, .0 }; // Background Color
Real global_indexref = 1.00; // Global Index Refraction
char *infile = nullptr; // Input File Name
Light *lightlist = nullptr; // Light-Source List
ushort maxdepth = 0; // Maximum Recursion Depth
ObjInfo *objlist = nullptr; // Object List
char *outfile = nullptr; // Output File Name
Stats stats = { 0, 0, 0, 0 }; // Status Information
Real Vangle = 45.0; // Viewing Angle
Point4 Vfrom = { 0.0, 0.0, 0.0, 100.0 }; // Camera Position
Vector4 Vover = { 0.0, 0.0, 1.0, 0.0 }; // View Over-Vector
Point4 Vto = { 0.0, 0.0, 0.0, 0.0 }; // View Target Point
Vector4 Vup = { 0.0, 1.0, 0.0, 0.0 }; // View Up-Vector
#else
extern Color ambient;
extern Attributes *attrlist;
extern Color background;
extern Real global_indexref;
extern char *infile;
extern Light *lightlist;
extern ushort maxdepth;
extern ObjInfo *objlist;
extern char *outfile;
extern Stats stats;
extern Real Vangle;
extern Point4 Vfrom;
extern Vector4 Vover;
extern Point4 Vto;
extern Vector4 Vup;
#endif

#endif

0 comments on commit adf7ec3

Please sign in to comment.