change object files' folder, ignore Doxygen configuration, and add <constant> key word on some functions
This commit is contained in:
parent
1aad8e5f9e
commit
e4fe5d696f
|
@ -4,3 +4,7 @@
|
|||
|
||||
*.c.o
|
||||
*.c.d
|
||||
|
||||
Doxyfile
|
||||
|
||||
*.tar.xz
|
||||
|
|
14
Makefile
14
Makefile
|
@ -22,8 +22,8 @@ arflags :=
|
|||
target := libfxengine.a
|
||||
|
||||
# Automatic names for object and dependency files
|
||||
src2obj = $(1:../src/%=src/%).o
|
||||
src2dep = $(1:../src/%=src/%).d
|
||||
src2obj = $(1:src/%=build/%).o
|
||||
src2dep = $(1:src/%=build/%).d
|
||||
|
||||
# Source files
|
||||
src := $(shell find src \
|
||||
|
@ -64,15 +64,15 @@ $(target): $(obj)
|
|||
$(call cmd_l,ar,$@) $(ar) rcs $(arflags) $@ $^
|
||||
|
||||
# Assembler sources
|
||||
src/%.s.o: src/%.s src/%.s.d
|
||||
build/%.s.o: src/%.s build/%.s.d
|
||||
@ mkdir -p $(dir $@)
|
||||
$(call cmd_b,as,$*.s) $(gcc) -c $< -o $@ $(sflags)
|
||||
src/%.S.o: src/%.S src/%.S.d
|
||||
build/%.S.o: src/%.S build/%.S.d
|
||||
@ mkdir -p $(dir $@)
|
||||
$(call cmd_b,as,$*.S) $(gcc) -c $< -o $@ $(sflags)
|
||||
|
||||
# C sources
|
||||
src/%.c.o: src/%.c src/%.c.d
|
||||
build/%.c.o: src/%.c build/%.c.d
|
||||
@ mkdir -p $(dir $@)
|
||||
$(call cmd_b,gcc,$*.c) $(gcc) -c $< -o $@ $(dflags) $(cflags)
|
||||
|
||||
|
@ -124,8 +124,8 @@ uninstall:
|
|||
|
||||
# Dependency information
|
||||
-include $(shell [ -d src ] && find src -name *.d)
|
||||
src/%.d: ;
|
||||
.PRECIOUS: src/%.d
|
||||
build/%.d: ;
|
||||
.PRECIOUS: build/%.d
|
||||
|
||||
.PHONY: all clean distclean
|
||||
|
||||
|
|
|
@ -5,11 +5,6 @@
|
|||
#include <fxengine/render/bitmap.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief Regulates the maximum fps count to 30 fps
|
||||
*/
|
||||
#define MINIMUM_FRAME_DELAY 3333
|
||||
|
||||
/**
|
||||
* @brief Triangle struct used to render fonctions
|
||||
* @param[out] part choose the used texture half
|
||||
|
|
|
@ -16,6 +16,6 @@ void render_zbuffer_clear();
|
|||
* retourne true si il faut dessiner le pixel
|
||||
* retourne false si le pixel est déjà existant
|
||||
**/
|
||||
bool render_zbuffer_set_px(uint32_t x, uint32_t y, uint32_t dist); // if you are allowed to draw the pixel on vram
|
||||
bool render_zbuffer_set_px(const uint32_t x, const uint32_t y, const uint32_t dist); // if you are allowed to draw the pixel on vram
|
||||
|
||||
#endif
|
||||
|
|
BIN
libfxengine.a
BIN
libfxengine.a
Binary file not shown.
|
@ -192,24 +192,23 @@ void render_display_triangle(const render_triangle * face)
|
|||
|
||||
for (int32_t x=txmin; x<=txmax; x++)
|
||||
{
|
||||
double vx, vy, z;
|
||||
const double xcalc = x - face->s1->x, ycalc = y - face->s1->y;
|
||||
// calcul de vx, vy
|
||||
vx=(xcalc*fact_1-ycalc*fact_2); // 0 <vx< 10_000
|
||||
vy=(ycalc*fact_3-xcalc*fact_4); // idem
|
||||
z=face->s1->z + (vx * zAB + vy * zAC) / 32768.0;
|
||||
vx /= 32768.0;
|
||||
vy /= 32768.0;
|
||||
int32_t vx, vy, z;
|
||||
|
||||
double vx2= ( vx/face->s2->z ) / ((1-vx)/face->s1->z + vx/face->s2->z);
|
||||
double vy2= ( vy/face->s3->z ) / ((1-vy)/face->s1->z + vy/face->s3->z);
|
||||
const int32_t xcalc = x - face->s1->x, ycalc = y - face->s1->y;
|
||||
// calcul de vx, vy
|
||||
vx = (xcalc*fact_1 - ycalc*fact_2);
|
||||
vy = (ycalc*fact_3 - xcalc*fact_4);
|
||||
z = face->s1->z + (vx * zAB + vy * zAC)/32768;
|
||||
|
||||
|
||||
int32_t vx2= ( vx*face->texture->size_px_x/face->s2->z ) / ((32768-vx)/face->s1->z + vx/face->s2->z);
|
||||
int32_t vy2= ( vy*face->texture->size_px_y/face->s3->z ) / ((32768-vy)/face->s1->z + vy/face->s3->z);
|
||||
/* Perspective correction
|
||||
vx /= (double) face->s2->z / ((1 - vx) / face->s1->z + vx / (double) face->s2->z);
|
||||
vy /= (double) face->s3->z / ((1 - vy) / face->s1->z + vy / (double) face->s3->z);
|
||||
*/
|
||||
// Affichage du point
|
||||
const uint8_t color = bitmap_get_pixel_r(face->texture, face->texture->size_px_x * vx2,
|
||||
face->texture->size_px_y * vy2);
|
||||
const uint8_t color = bitmap_get_pixel_r(face->texture, vx2, vy2);
|
||||
|
||||
if (color >> 1)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ void render_zbuffer_clear()
|
|||
|
||||
}
|
||||
|
||||
bool render_zbuffer_set_px(uint32_t x, uint32_t y, uint32_t dist)
|
||||
bool render_zbuffer_set_px(const uint32_t x, const uint32_t y, const uint32_t dist)
|
||||
{
|
||||
const int indice = x * render_height + y;
|
||||
|
||||
|
|
Loading…
Reference in New Issue