Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
ProjectiveTextureMapping
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WooHyungChoi
ProjectiveTextureMapping
Commits
65a9c3f6
Commit
65a9c3f6
authored
5 years ago
by
Woohyung Choi
Browse files
Options
Downloads
Patches
Plain Diff
Transfrom있던거 제거
parent
fa475c8b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
LearnOpenGL/OpenGLWrapper.cpp
+1
-83
1 addition, 83 deletions
LearnOpenGL/OpenGLWrapper.cpp
LearnOpenGL/OpenGLWrapper.h
+0
-29
0 additions, 29 deletions
LearnOpenGL/OpenGLWrapper.h
with
1 addition
and
112 deletions
LearnOpenGL/OpenGLWrapper.cpp
+
1
−
83
View file @
65a9c3f6
...
...
@@ -75,93 +75,11 @@ GLuint RenderObject::get_vertex_count()
return
mesh
->
get_vertex_count
();
}
Transform
::
Transform
()
{
translate
=
glm
::
vec3
(
0.0f
,
0.0f
,
0.0f
);
rotate
=
glm
::
vec3
(
0.0f
,
0.0f
,
0.0f
);
scale
=
glm
::
vec3
(
1.0f
,
1.0f
,
1.0f
);
update_model_matrix
();
update_directional_vector
();
}
glm
::
mat4
Transform
::
get_model_matrix
()
{
return
model
;
}
void
Transform
::
update_model_matrix
()
{
model
=
glm
::
mat4
(
1.0f
);
model
=
glm
::
translate
(
model
,
translate
);
model
=
glm
::
rotate
(
model
,
glm
::
radians
(
rotate
.
x
),
glm
::
vec3
(
1.0f
,
0.0f
,
0.0f
));
model
=
glm
::
rotate
(
model
,
glm
::
radians
(
rotate
.
y
),
glm
::
vec3
(
0.0f
,
1.0f
,
0.0f
));
model
=
glm
::
rotate
(
model
,
glm
::
radians
(
rotate
.
z
),
glm
::
vec3
(
0.0f
,
0.0f
,
1.0f
));
model
=
glm
::
scale
(
model
,
scale
);
}
void
Transform
::
update_directional_vector
()
{
glm
::
vec3
front
;
glm
::
vec3
up
;
glm
::
vec3
right
;
glm
::
vec3
_front
;
front
.
x
=
cos
(
glm
::
radians
(
rotate
.
y
))
*
cos
(
glm
::
radians
(
rotate
.
x
));
front
.
y
=
sin
(
glm
::
radians
(
rotate
.
x
));
front
.
z
=
sin
(
glm
::
radians
(
rotate
.
y
))
*
cos
(
glm
::
radians
(
rotate
.
x
));
front
=
glm
::
normalize
(
_front
);
right
=
glm
::
normalize
(
glm
::
cross
(
front
,
glm
::
vec3
(
0
,
1
,
0
)));
up
=
glm
::
normalize
(
glm
::
cross
(
right
,
front
));
}
Transform
*
RenderObject
::
get_transform
()
{
return
&
transform
;
}
void
Transform
::
set_translate
(
glm
::
vec3
_translate
)
{
translate
=
_translate
;
update_model_matrix
();
update_directional_vector
();
}
void
Transform
::
set_rotate
(
glm
::
vec3
_rotate
)
{
rotate
=
_rotate
;
update_model_matrix
();
update_directional_vector
();
}
void
Transform
::
set_scale
(
glm
::
vec3
_scale
)
{
scale
=
_scale
;
update_model_matrix
();
}
void
Transform
::
move
(
glm
::
vec3
_delta
)
{
translate
+=
_delta
;
update_model_matrix
();
update_directional_vector
();
}
void
Transform
::
move
(
glm
::
vec3
_direction
,
glm
::
vec1
_velocity
)
{
translate
+=
glm
::
vec3
(
_velocity
*
_direction
.
x
,
_velocity
*
_direction
.
y
,
_velocity
*
_direction
.
z
);
update_model_matrix
();
}
void
RenderObject
::
set_material
(
Material
*
_material
)
{
material
=
_material
;
...
...
@@ -214,7 +132,7 @@ void RenderObject::projective_render(Camera &camera)
0.0f
,
0.0f
,
0.5f
,
0.5f
,
0.0f
,
0.0f
,
0.0f
,
1.0f
};
glm
::
mat4
projector_view
=
glm
::
lookAt
(
camera
.
Position
,
camera
.
Position
+
camera
.
F
ront
,
camera
.
Up
);
glm
::
mat4
projector_view
=
glm
::
lookAt
(
camera
.
transform
.
get_translate
(),
camera
.
transform
.
get_translate
()
+
camera
.
transform
.
get_f
ront
()
,
camera
.
transform
.
get_up
()
);
glm
::
mat4
projector_projection
=
glm
::
perspective
(
glm
::
radians
(
camera
.
Zoom
),
1.0f
,
0.1f
,
100.0f
);
auto
prog
=
material
->
get_program
();
...
...
This diff is collapsed.
Click to expand it.
LearnOpenGL/OpenGLWrapper.h
+
0
−
29
View file @
65a9c3f6
...
...
@@ -50,35 +50,6 @@ public:
GLuint
get_specularMap
();
};
class
Transform
{
private:
glm
::
mat4
model
;
glm
::
vec3
translate
;
glm
::
vec3
rotate
;
glm
::
vec3
scale
;
glm
::
vec3
front
;
glm
::
vec3
up
;
glm
::
vec3
right
;
void
update_model_matrix
();
void
update_directional_vector
();
public:
Transform
();
glm
::
mat4
get_model_matrix
();
glm
::
vec3
get_front
();
void
set_translate
(
glm
::
vec3
_translate
);
void
set_rotate
(
glm
::
vec3
_rotate
);
void
set_scale
(
glm
::
vec3
_scale
);
void
move
(
glm
::
vec3
_delta
);
void
move
(
glm
::
vec3
_direction
,
glm
::
vec1
_velocity
);
};
class
RenderObject
{
private:
...
...
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