Procházet zdrojové kódy

Removed endian files

Thomas Buck před 11 roky
rodič
revize
ecac3d4abf
4 změnil soubory, kde provedl 27 přidání a 231 odebrání
  1. 2
    0
      ChangeLog
  2. 25
    60
      include/Light.h
  3. 0
    34
      include/endian.h
  4. 0
    137
      src/endian.cpp

+ 2
- 0
ChangeLog Zobrazit soubor

@@ -6,6 +6,8 @@
6 6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7 7
 
8 8
 	[ 20140110 ]
9
+	* Removed endian.(h/cpp) as it shouldn't be needed. See:
10
+	  http://commandcenter.blogspot.de/2012/04/byte-order-fallacy.html
9 11
 	* Removed empty Light.cpp
10 12
 	* All Unit Tests build without warning
11 13
 	* Converted many FIXME comments to be in the doxygen documentation

+ 25
- 60
include/Light.h Zobrazit soubor

@@ -1,68 +1,33 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*! \file include/Light.h
2
+ * \brief The GL light class
3 3
  *
4
- * Project : Freyja
5
- * Author  : Terry 'Mongoose' Hendrix II
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : Light
9
- * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments: This is the GL light class
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History ------------------------------------------------
17
- *
18
- * 2002.01.27:
19
- * Mongoose - Created
20
- ================================================================*/
21
-
4
+ * \author Mongoose
5
+ */
22 6
 
23
-#ifndef __FREYJA_MONGOOSE_LIGHT_H_
24
-#define __FREYJA_MONGOOSE_LIGHT_H_
7
+#ifndef _LIGHT_H_
8
+#define _LIGHT_H_
25 9
 
26 10
 #include <MatMath.h>
27 11
 
28
-
29
-class Light
30
-{
31
- public:
32
-
33
-	typedef enum
34
-   {
35
-		typePoint = 1,
36
-		typeSpot = 2,
37
-		typeDirectional = 3
38
-	} FreyjaLightType;
39
-
40
-
41
-	float mAmbient[4];          /* Ambient color */
42
-
43
-	float mDiffuse[4];          /* Diffuse color */
44
-
45
-	float mSpecular[4];         /* Specular color */
46
-
47
-	vec4_t mPos;                /* Light position in 3 space */
48
-
49
-	vec3_t mDir;                /* Light direction */
50
-
51
-	float mAtt;                 /* */
52
-
53
-	vec4_t mColor;              /* Color of light */
54
-
55
-	vec_t mCutoff;              /* Fade out distance */
56
-
57
-	FreyjaLightType mType;	    /* Type of light */
58
-
59
- private:
60
-
61
-	//unsigned int mFlags;        /* Flags for this light */
62
-
63
-	//unsigned int mId;           /* Unique identifier of this light */
64
-
65
-	//char *mName;                /* Light name */
12
+class Light {
13
+public:
14
+    typedef enum {
15
+        typePoint = 1,
16
+        typeSpot = 2,
17
+        typeDirectional = 3
18
+    } LightType;
19
+
20
+    // These aren't used anywhere? -- xythobuz
21
+    //float mAmbient[4]; //! Ambient color
22
+    //float mDiffuse[4]; //! Diffuse color
23
+    //float mSpecular[4]; //! Specular color
24
+
25
+    vec4_t mPos; //! Light position in 3 space
26
+    vec3_t mDir; //! Light direction
27
+    float mAtt;
28
+    vec4_t mColor; //! Color of light
29
+    vec_t mCutoff; //! Fade out distance
30
+    LightType mType; //! Type of light
66 31
 };
67 32
 
68 33
 #endif

+ 0
- 34
include/endian.h Zobrazit soubor

@@ -1,34 +0,0 @@
1
-/*==========================================================================
2
- * 
3
- * Project : MDDC 
4
- * Author  : Terry 'Mongoose' Hendrix II
5
- * Website : http://www.westga.edu/~stu7440
6
- * Email   : stu7440@westga.edu
7
- * Object  : 
8
- * Comments: This is the endian utils.
9
- *
10
- *           See file COPYING for license details.
11
- *
12
- *           Based on type converting code by: 
13
- *           Michael Vance <mkv102@psu.edu> 
14
- * 
15
- *-- History ---------------------------------------------------------- 
16
- *
17
- * See the source file's header.
18
- ==========================================================================*/
19
-
20
-#ifndef __MONGOOSE_ENDIAN_H
21
-#define __MONGOOSE_ENDIAN_H
22
-
23
-#include <stdio.h>
24
-
25
-
26
-// Disable name mangling
27
-extern "C"
28
-{
29
-  int fread_float_small(float *ptr, FILE *stream);
30
-  int fread_int_small(int *ptr, FILE *stream);
31
-  int fread_u_int_small(unsigned int *ptr, FILE *stream);
32
-}
33
-
34
-#endif

+ 0
- 137
src/endian.cpp Zobrazit soubor

@@ -1,137 +0,0 @@
1
-/*==========================================================================
2
- *
3
- * Project : MDDC
4
- * Author  : Terry 'Mongoose' Hendrix II
5
- * Website : http://www.westga.edu/~stu7440
6
- * Email   : stu7440@westga.edu
7
- * Object  :
8
- * Comments: This is the endian utils.
9
- *
10
- *           See file COPYING for license details.
11
- *
12
- *           Based on type converting code by:
13
- *           Michael Vance <mkv102@psu.edu>
14
- *
15
- *-- History ----------------------------------------------------------
16
- *
17
- * 2000-03-17:
18
- * Mongoose: Created, I combined some endian checking with fread wrapper
19
- ==========================================================================*/
20
-
21
-#include <endian.h>
22
-
23
-
24
-int fread_u_int_small(unsigned int *ptr, FILE *stream)
25
-{
26
-#ifdef BIG_ENDIAN
27
-   unsigned char b1, b2, b3, b4;
28
-   unsigned int l;
29
-#endif
30
-
31
-   if (fread(ptr, 4, 1, stream) != 1)
32
-   {
33
-      printf("FreadSmallInt> Failed fread.\n");
34
-      return false;
35
-   }
36
-
37
-#ifdef BIG_ENDIAN
38
-   l = *ptr;
39
-
40
-   b1 = l & 255;
41
-   b2 = ( l >> 8 ) & 255;
42
-   b3 = ( l >> 16 ) & 255;
43
-   b4 = ( l >> 24 ) & 255;
44
-  *ptr = ( (int) b1 << 24 ) + ( (int) b2 << 16 ) + ( (int) b3 << 8 ) + b4;
45
-#endif
46
-
47
-   return true;
48
-}
49
-
50
-
51
-int fread_int_small(int *ptr, FILE *stream)
52
-{
53
-#ifdef BIG_ENDIAN
54
-   unsigned char b1, b2, b3, b4;
55
-   int l;
56
-#endif
57
-
58
-   if (fread(ptr, 4, 1, stream) != 1)
59
-   {
60
-      printf("FreadSmallInt> Failed fread.\n");
61
-      return false;
62
-   }
63
-
64
-#ifdef BIG_ENDIAN
65
-   l = *ptr;
66
-
67
-   b1 = l & 255;
68
-   b2 = ( l >> 8 ) & 255;
69
-   b3 = ( l >> 16 ) & 255;
70
-   b4 = ( l >> 24 ) & 255;
71
-  *ptr = ( (int) b1 << 24 ) + ( (int) b2 << 16 ) + ( (int) b3 << 8 ) + b4;
72
-#endif
73
-
74
-   return true;
75
-}
76
-
77
-int fread_float_small(float *ptr, FILE *stream)
78
-{
79
-#ifdef BIG_ENDIAN
80
-   union
81
-   {
82
-      unsigned char b[4];
83
-      float f;
84
-   } in, out;
85
-
86
-   float l;
87
-#endif
88
-
89
-   if (fread(ptr, 4, 1, stream) != 1)
90
-   {
91
-      printf("FreadSmallFloat> Failed fread.\n");
92
-      return false;
93
-   }
94
-
95
-#ifdef BIG_ENDIAN
96
-   l = *ptr;
97
-
98
-   in.f = l;
99
-   out.b[0] = in.b[3];
100
-   out.b[1] = in.b[2];
101
-   out.b[2] = in.b[1];
102
-   out.b[3] = in.b[0];
103
-
104
-   *ptr = out.f;
105
-#endif
106
-
107
-   return true;
108
-}
109
-
110
-
111
-#ifdef NEW_API_PLANS
112
-
113
-/* FIXME: Add Big Endian support later */
114
-void fread_u8int_small(unsigned char *u, FILE *f)
115
-{
116
-	u_int8_t n;
117
-
118
-	fread(&n, 1, 1, f);
119
-	*u = n;
120
-}
121
-
122
-void fread_u16int_small(unsigned short *u, FILE *f)
123
-{
124
-	u_int16_t n;
125
-
126
-	fread(&n, 2, 1, f);
127
-	*u = n;
128
-}
129
-
130
-void fread_u32int_small(unsigned int *u, FILE *f)
131
-{
132
-	u_int32_t n;
133
-
134
-	fread(&n, 4, 1, f);
135
-	*u = n;
136
-}
137
-#endif

Loading…
Zrušit
Uložit