added camera_world_to_pixel_point
This commit is contained in:
parent
c62fed8ec2
commit
0c9e840986
|
@ -33,3 +33,12 @@ SDL_FRect camera_world_to_pixel_rect(Camera* self, SDL_FRect* world_space) {
|
||||||
size.x, size.y
|
size.x, size.y
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector camera_world_to_pixel_point(Camera* self, Vector point) {
|
||||||
|
Transform t = self->transform;
|
||||||
|
t.rotation = 0;
|
||||||
|
t.scale = OneVector;
|
||||||
|
t = transform_invert(t);
|
||||||
|
|
||||||
|
return vmulff(transform_point(&t, point), g_render_resolution.x / self->fov);
|
||||||
|
}
|
||||||
|
|
|
@ -18,5 +18,6 @@ extern Camera g_camera;
|
||||||
extern void camera_init();
|
extern void camera_init();
|
||||||
extern SDL_FRect camera_screen_to_world_space(Camera* self, SDL_FRect* camera_space);
|
extern SDL_FRect camera_screen_to_world_space(Camera* self, SDL_FRect* camera_space);
|
||||||
extern SDL_FRect camera_world_to_pixel_rect(Camera* self, SDL_FRect* world_space);
|
extern SDL_FRect camera_world_to_pixel_rect(Camera* self, SDL_FRect* world_space);
|
||||||
|
extern Vector camera_world_to_pixel_point(Camera* self, Vector point);
|
||||||
|
|
||||||
#endif // !_fencer_camera_h
|
#endif // !_fencer_camera_h
|
||||||
|
|
Loading…
Reference in a new issue