projects
/
sx
/
simavr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
regExp
home
|
summary
|
tags
|
heads
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
raw
|
patch
| inline |
side by side
(parent:
90da542
)
Commit
2463c19868be5e060bb8c0cf897d89397a6d88be
author
Michel Pollet
<buserror@gmail.com>
Tue, 12 Jun 2012 17:27:31 +0000
(18:27 +0100)
committer
Michel Pollet
<buserror@gmail.com>
Tue, 12 Jun 2012 17:27:31 +0000
(18:27 +0100)
Moved stuff around and added the translation to eye coordinates
to the matrix.
Signed-off-by: Michel Pollet <buserror@gmail.com>
3 files changed:
examples/shared/libc3/src/c3camera.c
patch
|
blob
|
history
|
download
examples/shared/libc3/src/c3camera.h
patch
|
blob
|
history
|
download
examples/shared/libc3/src/c3context.c
patch
|
blob
|
history
|
download
diff --git
a/examples/shared/libc3/src/c3camera.c
b/examples/shared/libc3/src/c3camera.c
index be3070d5818cf22de2b0b0c7e0b8277cbff8cf40..f4eef0ff87a4b851c34c1b8555723d25c3b69cef 100644
(file)
--- a/
examples/shared/libc3/src/c3camera.c
+++ b/
examples/shared/libc3/src/c3camera.c
@@
-317,38
+317,14
@@
c3cam_update_matrix(
{
c3cam_update(c);
- c->mtx = c3mat4_vec4(
+ c3mat4 m1 = translation3D(c3vec3_minus(c->eye));
+ c3mat4 m2 = c3mat4_vec4(
c3vec4f(c->side.n[VX], c->up.n[VX], c->forward.n[VX], 0.0),
c3vec4f(c->side.n[VY], c->up.n[VY], c->forward.n[VY], 0.0),
c3vec4f(c->side.n[VZ], c->up.n[VZ], c->forward.n[VZ], 0.0),
c3vec4f(0.0, 0.0, 0.0, 1.0));
+ c->mtx = c3mat4_mul(&m1, &m2);
}
-#if 0
-void
-c3cam_load_to_openGL(c3cam_p c)
-{
- c3mat4 m;
-
- make_mtx();
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glMultMatrixf( (c3f*) &mtx[0][0]);
- glTranslatef( -eye[VX], -eye[VY], -eye[VZ] );
-}
-
-void
-c3cam_load_to_openGL_noident(c3cam_p c)
-{
- c3mat4 m;
-
- make_mtx();
-
- glMatrixMode( GL_MODELVIEW );
- glMultMatrixf( (c3f*) &mtx[0][0]);
- glTranslatef( -eye[VX], -eye[VY], -eye[VZ] );
-}
-#endif
void
c3cam_reset(
@@
-364,11
+340,12
@@
c3cam_reset(
c3cam_update(c);
}
-c3cam_
t
+c3cam_
p
c3cam_new()
{
- c3cam_t c;
- c3cam_reset(&c);
+ c3cam_p c = malloc(sizeof(*c));
+ memset(c, 0, sizeof(*c));
+ c3cam_reset(c);
return c;
}
@@
-376,6
+353,7
@@
void
c3cam_init(
c3cam_p c)
{
+ memset(c, 0, sizeof(*c));
c3cam_reset(c);
}
@@
-395,17
+373,3
@@
c3cam_update(
c->up = c3vec3_normalize(c->up);
c->side = c3vec3_normalize(c->side);
}
-
-# if 0
-void
-c3cam_dump(c3cam_p c, FILE *output) const
-{
- fprintf( output, "Viewmodel: \n" );
- eye.print( output, " eye" );
- lookat.print( output, " lookat" );
- up.print( output, " up" );
- side.print( output, " side" );
- forward.print(output, " forward");
- mtx.print( output, " mtx" );
-}
-#endif
diff --git
a/examples/shared/libc3/src/c3camera.h
b/examples/shared/libc3/src/c3camera.h
index 1a719db3223fc4622260a3bbad726d7af7fb2ee7..5f47af761438fba3c5a9d03373d04db269110e8b 100644
(file)
--- a/
examples/shared/libc3/src/c3camera.h
+++ b/
examples/shared/libc3/src/c3camera.h
@@
-220,7
+220,7
@@
c3cam_reset(
/******************************* c3cam_t() ************/
/* Constructor */
-c3cam_
t
+c3cam_
p
c3cam_new();
void
@@
-232,9
+232,4
@@
c3cam_init(
void c3cam_update(
c3cam_p c);
-/******************************* dump() *******************/
-/* Prints the contents of this class to a file, typically */
-/* stdin or stderr */
-//void c3cam_dump(FILE *output);
-
#endif /* __C3VIEW_H___ */
diff --git
a/examples/shared/libc3/src/c3context.c
b/examples/shared/libc3/src/c3context.c
index 79508e6168eacc4e4975f3e4236fe0fcd9be0199..8a85c93f216438c525f09f0a9786d34336488419 100644
(file)
--- a/
examples/shared/libc3/src/c3context.c
+++ b/
examples/shared/libc3/src/c3context.c
@@
-44,9
+44,9
@@
c3context_init(
c3context_view_t v = {
.type = C3_CONTEXT_VIEW_EYE,
.size = c3vec2f(w, h),
- .cam = c3cam_new(),
.dirty = 1,
};
+ c3cam_init(&v.cam);
c3context_view_array_add(&c->views, v);
c->root = c3object_new(NULL);
c->root->context = c;