Skip to content

Commit

Permalink
chore: Render coord conversion, Vector replace float to double
Browse files Browse the repository at this point in the history
  • Loading branch information
but0n committed Apr 15, 2018
1 parent 8bf1fbf commit 1299ff3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ol3d_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ unsigned char *render_target = &render_buffer;
#define AABB_MIN(x, y, z) (fmin((x), fmin((y), (z))))
#define AABB_MAX(x, y, z) (fmax((x), fmax((y), (z))))
#define isLeft(_a, _b, _p) (((_b->x-_a->x) * (_p->y-_a->y) - (_b->y-_a->y) * (_p->x-_a->x))>0)
#define COORD(x) (SCREEN_SIZE * ((x) + 1.0) * 0.5)
#define COORD(x) (SCREEN_SIZE * ((x)*0.5 + 0.5))

static unsigned char inTriangle(
ol3d_Vector3_t *a,
Expand Down
4 changes: 2 additions & 2 deletions ol3d_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ ol3d_Vector3_t ol3d_vector_subtract(const ol3d_Vector3_t *a, const ol3d_Vector3_
};
}

ol3d_Vector3_t ol3d_vector_multiply(const ol3d_Vector3_t *a, float b) {
ol3d_Vector3_t ol3d_vector_multiply(const ol3d_Vector3_t *a, double b) {
return (ol3d_Vector3_t) {
.x = a->x * b,
.y = a->y * b,
.z = a->z * b
};
}

ol3d_Vector3_t ol3d_vector_divide(const ol3d_Vector3_t *a, float b) {
ol3d_Vector3_t ol3d_vector_divide(const ol3d_Vector3_t *a, double b) {
return (ol3d_Vector3_t) {
.x = a->x / b,
.y = a->y / b,
Expand Down
4 changes: 2 additions & 2 deletions ol3d_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ extern double ol3d_vector_length(const ol3d_Vector3_t *a);
extern ol3d_Vector3_t ol3d_vector_normalize(const ol3d_Vector3_t *a);
extern ol3d_Vector3_t ol3d_vector_add(const ol3d_Vector3_t *a, const ol3d_Vector3_t *b);
extern ol3d_Vector3_t ol3d_vector_subtract(const ol3d_Vector3_t *a, const ol3d_Vector3_t *b);
extern ol3d_Vector3_t ol3d_vector_multiply(const ol3d_Vector3_t *a, float b);
extern ol3d_Vector3_t ol3d_vector_divide(const ol3d_Vector3_t *a, float b);
extern ol3d_Vector3_t ol3d_vector_multiply(const ol3d_Vector3_t *a, double b);
extern ol3d_Vector3_t ol3d_vector_divide(const ol3d_Vector3_t *a, double b);
extern ol3d_Vector3_t ol3d_vector_cross(const ol3d_Vector3_t *a, const ol3d_Vector3_t *b);

#endif

0 comments on commit 1299ff3

Please sign in to comment.