Skip to content

Commit c52c176

Browse files
authored
Implemented basic Wavefront OBJ import. (#90)
1 parent 7d06e7f commit c52c176

File tree

18 files changed

+937
-277
lines changed

18 files changed

+937
-277
lines changed

changes.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Prior to the release of 3.7.1, the following items still need urgent attention:
4949
New Features
5050
------------
5151

52+
- Basic support for importing Wavefront OBJ files has been added as an extension
53+
to the `mesh` primitive.
54+
5255
- The `map_type` keyword now supports the Angular Map projection for light
5356
probes, popularized by Paul Devebec, as type 7.
5457

@@ -109,6 +112,12 @@ For more details on the above new features, see the documentation.
109112
Changed Behaviour
110113
-----------------
111114

115+
- The `mesh2` syntax has been absorbed into that of `mesh` (i.e. you can now
116+
replace any occurrences of the `mesh2` keyword with `mesh`), to reflect the
117+
fact that they are just two syntax variants for one and the same primitive.
118+
The old `mesh2` keyword is retained for backward compatibility and, in
119+
acknowledgement of its widespread use, remains non-deprecated.
120+
112121
- The `version` pseudo-variable will now evaluate to the effective language
113122
version at the time the expression is parsed, _except_ when used in a
114123
`#version` directive, in which case the behaviour remains unchanged.

source/base/fileinputoutput.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ enum
7272
POV_File_Text_Macro = POV_File_Text_INC,
7373
POV_File_Text_INI,
7474
POV_File_Text_CSV,
75+
POV_File_Text_OBJ,
7576
POV_File_Text_Stream,
7677
POV_File_Text_User,
7778
POV_File_Data_DF3,

source/base/fileutil.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ POV_File_Restrictions gPOV_File_Restrictions[POV_File_Count] =
8383
{ true, false, false, false }, // POV_File_Text_INC
8484
{ true, false, false, false }, // POV_File_Text_INI
8585
{ true, true, false, false }, // POV_File_Text_CSV
86+
{ true, true, false, false }, // POV_File_Text_OBJ
8687
{ true, false, false, false }, // POV_File_Text_Stream
8788
{ true, true, false, false }, // POV_File_Text_User
8889
{ true, true, true, false }, // POV_File_Data_DF3
@@ -128,6 +129,7 @@ POV_File_Extensions gPOV_File_Extensions[POV_File_Count] =
128129
{{ ".inc", ".INC", "", "" }}, // POV_File_Text_INC
129130
{{ ".ini", ".INI", "", "" }}, // POV_File_Text_INI
130131
{{ ".csv", ".CSV", "", "" }}, // POV_File_Text_CSV
132+
{{ ".obj", ".OBJ", "", "" }}, // POV_File_Text_OBJ
131133
{{ ".txt", ".TXT", "", "" }}, // POV_File_Text_Stream
132134
{{ "", "", "", "" }}, // POV_File_Text_User
133135
{{ ".df3", ".DF3", "", "" }}, // POV_File_Data_DF3
@@ -157,6 +159,7 @@ const int gFile_Type_To_Mask [POV_File_Count] =
157159
NO_FILE, // POV_File_Text_INC
158160
NO_FILE, // POV_File_Text_INI
159161
NO_FILE, // POV_File_Text_CSV
162+
NO_FILE, // POV_File_Text_OBJ
160163
NO_FILE, // POV_File_Text_Stream
161164
NO_FILE, // POV_File_Text_User
162165
NO_FILE, // POV_File_Data_DF3

source/base/mathutil.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ inline T1 RoundDownToMultiple(T1 x, T2 base) { return x - (x % base); }
144144
template<typename T1, typename T2>
145145
inline T1 RoundUpToMultiple(T1 x, T2 base) { return RoundDownToMultiple (x + base - 1, base); }
146146

147+
/// Test whether a value is in a given range
148+
///
149+
/// This function tests whether the specified value is within the specified interval.
150+
/// The boundaries are considered part of the interval.
151+
///
152+
template<typename T1, typename T2>
153+
inline bool IsInRange (T1 value, T2 min, T2 max)
154+
{
155+
return (min <= value) && (value <= max);
156+
}
157+
147158
}
148159

149160
#endif // POVRAY_BASE_MATHUTIL_H

source/base/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define OFFICIAL_VERSION_STRING "3.7.1"
4646
#define OFFICIAL_VERSION_NUMBER 371
4747

48-
#define POV_RAY_PRERELEASE "alpha.8778710"
48+
#define POV_RAY_PRERELEASE "x.obj.8787755"
4949

5050
#if (POV_RAY_IS_AUTOBUILD == 1) && ((POV_RAY_IS_OFFICIAL == 1) || (POV_RAY_IS_SEMI_OFFICIAL == 1))
5151
#ifdef POV_RAY_PRERELEASE

0 commit comments

Comments
 (0)