summaryrefslogtreecommitdiff
path: root/src/scene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/scene.cpp')
-rw-r--r--src/scene.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/scene.cpp b/src/scene.cpp
index f69398d..44e7028 100644
--- a/src/scene.cpp
+++ b/src/scene.cpp
@@ -2,7 +2,7 @@
Scene::Scene() {
directional_light = {0, 0, -1};
- viewport_dimension = {2, 3};
+ viewport_dimension = {3, 2};
scene_dimension = {SCREEN_WIDTH / 2, SCREEN_HEIGHT};
z_plane = int2fx(1);
@@ -21,13 +21,11 @@ POINT Scene::project_2d(VECTOR vertex) {
}
POINT Scene::viewport_to_scene(POINT p) {
- FIXED x = fxmul(
- p.x, (std::get<0>(scene_dimension) / std::get<0>(viewport_dimension))
- << FIX_SHIFT);
- FIXED y = fxmul(
- p.y, (std::get<1>(scene_dimension) / std::get<1>(viewport_dimension))
- << FIX_SHIFT);
- return {x, y};
+ FIXED x = fxmul(p.x, int2fx(std::get<0>(scene_dimension) /
+ std::get<0>(viewport_dimension)));
+ FIXED y = fxmul(p.y, int2fx(std::get<1>(scene_dimension) /
+ std::get<1>(viewport_dimension)));
+ return {x >> FIX_SHIFT, y >> FIX_SHIFT};
}
void Scene::draw_line(POINT p0, POINT p1, std::uint8_t pal_idx) {
@@ -36,5 +34,5 @@ void Scene::draw_line(POINT p0, POINT p1, std::uint8_t pal_idx) {
std::uint16_t pixels = (pal_idx << 8) | pal_idx;
bmp16_line(scene_p0.x, scene_p0.y, scene_p1.x, scene_p1.y, pixels, vid_page,
- M4_WIDTH);
+ SCREEN_WIDTH);
}