Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
acgl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACGL
acgl
Commits
2d97c252
Commit
2d97c252
authored
12 years ago
by
Robert Menzel
Browse files
Options
Downloads
Plain Diff
merged conflict
parents
18c850a5
a5ec6617
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ACGL/OpenGL/Data/GeometryDataLoadStoreOBJ.cc
+27
-5
27 additions, 5 deletions
src/ACGL/OpenGL/Data/GeometryDataLoadStoreOBJ.cc
with
27 additions
and
5 deletions
src/ACGL/OpenGL/Data/GeometryDataLoadStoreOBJ.cc
+
27
−
5
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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment