Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OpenGL
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
C-Fu
OpenGL
Commits
23ce5829
Commit
23ce5829
authored
8 years ago
by
Anakin
Browse files
Options
Downloads
Patches
Plain Diff
fixed the multiedged polygons
parent
232acedc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MshViewer/Source/OpenGlController.cpp
+3
-8
3 additions, 8 deletions
MshViewer/Source/OpenGlController.cpp
MshViewer/Source/Texture.cpp
+0
-1
0 additions, 1 deletion
MshViewer/Source/Texture.cpp
README.md
+1
-4
1 addition, 4 deletions
README.md
with
4 additions
and
13 deletions
MshViewer/Source/OpenGlController.cpp
+
3
−
8
View file @
23ce5829
...
...
@@ -6,7 +6,6 @@
#include
<string>
#include
<glm\gtc\matrix_transform.hpp>
#include
<iostream>
#define VERTEX_SHADER "Shader/TextureShader.vert"
#define FRAGMENT_SHADER "Shader/TextureShader.frag"
...
...
@@ -389,21 +388,19 @@ void OpenGLController::loadMsh(const char * path)
{
for
(
auto
&
mshIt
:
segIt
->
meshIndices
)
// for every polygon
{
std
::
cout
<<
"== Poly =="
<<
std
::
endl
;
if
(
mshIt
->
size
()
>=
3
)
// multipoly
{
// for every triangle of the multi polygon
for
(
unsigned
int
tri
=
0
;
tri
<
mshIt
->
size
()
-
2
;
tri
++
)
{
std
::
cout
<<
"== Triangle =="
<<
std
::
endl
;
// for every edge of the triangle
for
(
int
triEdge
=
0
;
triEdge
<
3
;
triEdge
++
)
{
Vertex
tempVertex
;
// every edge has 3 coordinates
for
(
int
j
=
0
;
j
<
3
;
j
++
)
tempVertex
.
position
[
j
]
=
(
GLfloat
)
segIt
->
vertex
[(
*
mshIt
)[
tri
Edge
>
0
?
tri
+
triEdge
:
0
]
*
3
+
j
];
std
::
cout
<<
(
triEdge
>
0
?
tri
+
triEdge
:
0
)
<<
std
::
endl
;
tempVertex
.
position
[
j
]
=
(
GLfloat
)
segIt
->
vertex
[(
*
mshIt
)[
tri
+
triEdge
-
((
tri
%
2
)
*
(
triEdge
-
1
)
*
2
)
]
*
3
+
j
];
// and 2 UV
if
(
segIt
->
uv
==
NULL
)
{
...
...
@@ -413,7 +410,7 @@ void OpenGLController::loadMsh(const char * path)
else
{
for
(
int
j
=
0
;
j
<
2
;
j
++
)
tempVertex
.
uv
[
j
]
=
(
GLfloat
)
segIt
->
uv
[(
*
mshIt
)[
tri
Edge
>
0
?
tri
+
triEdge
:
0
]
*
2
+
j
];
tempVertex
.
uv
[
j
]
=
(
GLfloat
)
segIt
->
uv
[(
*
mshIt
)[
tri
+
triEdge
-
((
tri
%
2
)
*
(
triEdge
-
1
)
*
2
)
]
*
2
+
j
];
}
tempBufferData
.
push_back
(
tempVertex
);
}
...
...
@@ -462,7 +459,6 @@ void OpenGLController::loadMsh(const char * path)
}
catch
(
std
::
invalid_argument
e
)
{
GLubyte
solidColor
[
4
]
=
{
0
,
0
,
255
,
255
};
tempData
->
alpha
=
true
;
tempData
->
width
=
1
;
tempData
->
height
=
1
;
...
...
@@ -474,7 +470,6 @@ void OpenGLController::loadMsh(const char * path)
// add a solid default color at the end (maybe there is an invalid index later)
textureData
*
tempData
=
new
textureData
;
GLubyte
solidColor
[
4
]
=
{
0
,
0
,
255
,
255
};
tempData
->
alpha
=
true
;
tempData
->
width
=
1
;
tempData
->
height
=
1
;
...
...
This diff is collapsed.
Click to expand it.
MshViewer/Source/Texture.cpp
+
0
−
1
View file @
23ce5829
...
...
@@ -57,7 +57,6 @@ TextureTGA::TextureTGA(const char * filePath)
std
::
uint8_t
tempChunkHeader
;
std
::
uint8_t
tempData
[
5
];
unsigned
int
tempByteIndex
=
0
;
std
::
size_t
tempPixelIndex
=
0
;
do
{
fsPicture
.
read
(
reinterpret_cast
<
char
*>
(
&
tempChunkHeader
),
sizeof
(
tempChunkHeader
));
...
...
This diff is collapsed.
Click to expand it.
README.md
+
1
−
4
View file @
23ce5829
...
...
@@ -13,10 +13,7 @@ Feel free to use my code the way you like. But remember i used some public libra
licence, too.
### To Do
-
cluster use wrong textures
-
use normals or fix ccw and cw
-
multipoly triangulation not 100% good
-
cloth testing
-
cloth not working correctly
-
optional display bones, shadow, collision,...
-
integrate into a software:
-> gui open file ( + drag and drop),
...
...
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