Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
2d97c252
Commit
2d97c252
authored
Mar 26, 2013
by
Robert Menzel
Browse files
merged conflict
parents
18c850a5
a5ec6617
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ACGL/OpenGL/Data/GeometryDataLoadStoreOBJ.cc
View file @
2d97c252
...
...
@@ -194,7 +194,7 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
std
::
vector
<
IndexTuple
>
pointIndices
=
parseIndices
(
parameters
);
// points are just added in order
for
(
unsigned
in
t
i
=
0
;
i
<
pointIndices
.
size
();
++
i
)
for
(
size_
t
i
=
0
;
i
<
pointIndices
.
size
();
++
i
)
{
indices
.
push_back
(
pointIndices
[
i
]);
}
...
...
@@ -211,7 +211,7 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
std
::
vector
<
IndexTuple
>
lineIndices
=
parseIndices
(
parameters
);
// add line segments for the line strip defined by the vertices
for
(
unsigned
in
t
i
=
0
;
i
<
lineIndices
.
size
()
-
1
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
lineIndices
.
size
()
-
1
;
++
i
)
{
indices
.
push_back
(
lineIndices
[
i
]);
indices
.
push_back
(
lineIndices
[
i
+
1
]);
...
...
@@ -229,13 +229,35 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
std
::
vector
<
IndexTuple
>
faceIndices
=
parseIndices
(
parameters
);
// triangulate the polygon defined by the indices
for
(
unsigned
in
t
i
=
1
;
i
<
faceIndices
.
size
()
-
1
;
++
i
)
for
(
size_
t
i
=
1
;
i
<
faceIndices
.
size
()
-
1
;
++
i
)
{
indices
.
push_back
(
faceIndices
[
0
]);
indices
.
push_back
(
faceIndices
[
i
]);
indices
.
push_back
(
faceIndices
[
i
+
1
]);
}
}
else
if
(
keyword
==
"bevel"
||
keyword
==
"bmat"
||
keyword
==
"bsp"
||
keyword
==
"bzp"
||
keyword
==
"c_interp"
||
keyword
==
"cdc"
||
keyword
==
"cdp"
||
keyword
==
"con"
||
keyword
==
"cstype"
||
keyword
==
"ctech"
||
keyword
==
"curv"
||
keyword
==
"curv2"
||
keyword
==
"d_interp"
||
keyword
==
"deg"
||
keyword
==
"end"
||
keyword
==
"g"
||
keyword
==
"hole"
||
keyword
==
"lod"
||
keyword
==
"maplib"
||
keyword
==
"mg"
||
keyword
==
"mtllib"
||
keyword
==
"o"
||
keyword
==
"parm"
||
keyword
==
"res"
||
keyword
==
"s"
||
keyword
==
"scrv"
||
keyword
==
"shadow_obj"
||
keyword
==
"sp"
||
keyword
==
"stech"
||
keyword
==
"step"
||
keyword
==
"surf"
||
keyword
==
"trace_obj"
||
keyword
==
"trim"
||
keyword
==
"usemap"
||
keyword
==
"usemtl"
||
keyword
==
"vp"
)
{
// part of the OBJ specification (i.e. non-polygonal geometry, object groups, etc.)
// is not supported and is silently ignored
}
else
{
warning
()
<<
"unknown OBJ keyword ignored: "
<<
keyword
<<
std
::
endl
;
...
...
@@ -249,7 +271,7 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
GLfloat
*
abData
=
new
GLfloat
[
abDataElements
];
size_t
pos
=
0
;
for
(
unsigned
in
t
i
=
0
;
i
<
indices
.
size
();
++
i
)
for
(
size_
t
i
=
0
;
i
<
indices
.
size
();
++
i
)
{
const
glm
::
vec4
&
position
=
positionData
[
indices
[
i
].
position
];
abData
[
pos
++
]
=
position
.
x
;
...
...
@@ -276,7 +298,7 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
}
size_t
strideSize
=
0
;
ArrayBuffer
::
Attribute
attrPosition
=
{
"aPosition"
,
GL_FLOAT
,
positionDimension
,
0
,
GL_FALSE
,
0
,
GL_FALSE
};
ArrayBuffer
::
Attribute
attrPosition
=
{
"aPosition"
,
GL_FLOAT
,
positionDimension
,
(
GLuint
)
0
,
GL_FALSE
,
0
,
GL_FALSE
};
strideSize
+=
positionDimension
*
sizeof
(
GLfloat
);
data
->
mAttributes
.
push_back
(
attrPosition
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment