Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
OpenGL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
C-Fu
OpenGL
Commits
b4bd3144
Commit
b4bd3144
authored
Nov 12, 2016
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up code
parent
2524971d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
47 deletions
+19
-47
MshViewer/Header/Object.h
MshViewer/Header/Object.h
+10
-12
MshViewer/Header/OpenGLController.h
MshViewer/Header/OpenGLController.h
+2
-4
MshViewer/Source/Object.cpp
MshViewer/Source/Object.cpp
+2
-15
MshViewer/Source/OpenGlController.cpp
MshViewer/Source/OpenGlController.cpp
+5
-8
MshViewer/Source/Texture.cpp
MshViewer/Source/Texture.cpp
+0
-2
MshViewer/Source/callback.cpp
MshViewer/Source/callback.cpp
+0
-3
MshViewer/main.cpp
MshViewer/main.cpp
+0
-3
No files found.
MshViewer/Header/Object.h
View file @
b4bd3144
...
...
@@ -3,7 +3,6 @@
#include <list>
#include <fstream>
#include <string>
#include <gl\glew.h>
#include <glm\gtc\matrix_transform.hpp>
enum
Mtyp
{
...
...
@@ -22,16 +21,16 @@ struct ChunkHeader {
};
struct
Modl
{
std
::
string
name
;
std
::
string
parent
;
Mtyp
type
;
std
::
uint32_t
renderFlags
;
glm
::
mat4
m4x4Translation
;
std
::
string
texture
;
float
*
vertex
;
float
*
uv
;
std
::
uint32_t
*
mesh
;
std
::
uint32_t
meshSize
;
std
::
string
name
=
""
;
std
::
string
parent
=
""
;
Mtyp
type
=
null
;
std
::
int32_t
renderFlags
=
-
1
;
glm
::
mat4
m4x4Translation
=
glm
::
mat4
(
1.0
f
)
;
std
::
string
texture
=
""
;
float
*
vertex
=
nullptr
;
float
*
uv
=
nullptr
;
std
::
uint32_t
*
mesh
=
nullptr
;
std
::
uint32_t
meshSize
=
0
;
};
...
...
@@ -49,7 +48,6 @@ private:
private:
void
setModlDefault
(
Modl
*
model
);
void
loadChunks
(
std
::
list
<
ChunkHeader
*>
&
destination
,
std
::
streampos
start
,
const
std
::
uint32_t
end
);
void
analyseMsh2Chunks
(
std
::
list
<
ChunkHeader
*>
&
chunkList
);
void
analyseMatdChunks
(
std
::
list
<
ChunkHeader
*>
&
chunkList
);
...
...
MshViewer/Header/OpenGLController.h
View file @
b4bd3144
#pragma once
#include <string>
#include <gl\glew.h>
#include <gl\glfw3.h>
#include <glm\glm.hpp>
#include <vector>
#include "Object.h"
#include "Texture.h"
#include <vector>
#define VERTEX_INDEX_XYZ 0
#define VERTEX_INDEX_UV 1
...
...
MshViewer/Source/Object.cpp
View file @
b4bd3144
#include "Object.h"
#include <iostream>
#define PI (4.0*atan(1.0))
...
...
@@ -72,20 +74,6 @@ Object::~Object()
/////////////////////////////////////////////////////////////////////////
// private functions
void
Object
::
setModlDefault
(
Modl
*
model
)
{
model
->
name
=
""
;
model
->
parent
=
""
;
model
->
type
=
null
;
model
->
renderFlags
=
-
1
;
model
->
m4x4Translation
=
glm
::
mat4
(
1.0
f
);
model
->
texture
=
""
;
model
->
vertex
=
NULL
;
model
->
uv
=
NULL
;
model
->
mesh
=
NULL
;
model
->
meshSize
=
0
;
}
void
Object
::
loadChunks
(
std
::
list
<
ChunkHeader
*>&
destination
,
std
::
streampos
start
,
const
std
::
uint32_t
end
)
{
// jump to first chunk
...
...
@@ -170,7 +158,6 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
if
(
!
strcmp
(
"MODL"
,
(
*
it
)
->
name
))
{
Modl
*
tempModl
=
new
Modl
;
setModlDefault
(
tempModl
);
// get all subchunks
std
::
list
<
ChunkHeader
*>
tempChunks
;
...
...
MshViewer/Source/OpenGlController.cpp
View file @
b4bd3144
#include <gl\glew.h>
#include <gl\glfw3.h>
#include <Windows.h>
#include "OpenGLController.h"
#include "callback.h"
#include <glm\gtc\matrix_transform.hpp>
#include "shader.hpp"
#include "Texture.h"
#include <iostream>
#include <Windows.h>
#include <string>
#include <glm\gtc\matrix_transform.hpp>
#define VERTEX_SHADER "Shader/TextureShader.vert"
#define FRAGMENT_SHADER "Shader/TextureShader.frag"
#define MAX_MODEL_COUNT 1000
/////////////////////////////////////////////////////////////////////////
// public constructor/destructor
...
...
@@ -282,7 +279,7 @@ void OpenGLController::updateScene()
int
instanceOffset
(
0
);
for
(
int
modelIndex
=
0
;
modelIndex
<
vModels
.
size
();
modelIndex
++
)
for
(
unsigned
int
modelIndex
=
0
;
modelIndex
<
vModels
.
size
();
modelIndex
++
)
{
// give texture to the shader
glTexImage2D
(
GL_TEXTURE_2D
,
...
...
MshViewer/Source/Texture.cpp
View file @
b4bd3144
#include "Texture.h"
#include <iostream>
#include <fstream>
#include <Windows.h>
TextureTGA
::
TextureTGA
(
const
char
*
filePath
)
{
...
...
MshViewer/Source/callback.cpp
View file @
b4bd3144
//#include "callback.h"
#include <gl\glew.h>
#include <gl\glfw3.h>
#include "OpenGLController.h"
...
...
MshViewer/main.cpp
View file @
b4bd3144
...
...
@@ -3,9 +3,6 @@
#endif // DEBUG
#include "OpenGLController.h"
#include "Object.h"
#include <iostream>
#include <Windows.h>
int
main
(
int
argc
,
char
**
argv
)
{
...
...
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