Move camera
This commit is contained in:
parent
edcde03fa3
commit
ee15824329
3 changed files with 60 additions and 3 deletions
26
renderer.h
26
renderer.h
|
@ -1,3 +1,7 @@
|
|||
/**
|
||||
3D renderer: implements 3D rendering.
|
||||
*/
|
||||
|
||||
#ifndef _LCR_RENDERER_H
|
||||
#define _LCR_RENDERER_H
|
||||
|
||||
|
@ -10,6 +14,8 @@
|
|||
struct LCR_Renderer
|
||||
{
|
||||
// TODO
|
||||
|
||||
|
||||
};
|
||||
|
||||
S3L_Scene LCR_scene3D;
|
||||
|
@ -59,6 +65,26 @@ uint8_t LCR_rendererInit(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void LCR_getCameraPos(LCR_SpaceUnit pos[3])
|
||||
{
|
||||
pos[0] = (LCR_scene3D.camera.transform.translation.x *
|
||||
LCR_SQUARE_SIDE_LEN) / S3L_FRACTIONS_PER_UNIT;
|
||||
pos[1] = (LCR_scene3D.camera.transform.translation.y *
|
||||
LCR_SQUARE_SIDE_LEN) / S3L_FRACTIONS_PER_UNIT;
|
||||
pos[2] = (LCR_scene3D.camera.transform.translation.z *
|
||||
LCR_SQUARE_SIDE_LEN) / S3L_FRACTIONS_PER_UNIT;
|
||||
}
|
||||
|
||||
void LCR_setCameraPos(LCR_SpaceUnit pos[3])
|
||||
{
|
||||
LCR_scene3D.camera.transform.translation.x =
|
||||
(pos[0] * S3L_FRACTIONS_PER_UNIT) / LCR_SQUARE_SIDE_LEN;
|
||||
LCR_scene3D.camera.transform.translation.y =
|
||||
(pos[1] * S3L_FRACTIONS_PER_UNIT) / LCR_SQUARE_SIDE_LEN;
|
||||
LCR_scene3D.camera.transform.translation.z =
|
||||
(pos[2] * S3L_FRACTIONS_PER_UNIT) / LCR_SQUARE_SIDE_LEN;
|
||||
}
|
||||
|
||||
void LCR_render(void)
|
||||
{
|
||||
S3L_newFrame();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue