Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
vs49688 committed May 7, 2024
1 parent b9f2159 commit 3f98754
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion drivers/sdl2dev/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ br_error BrSDLUtilResizeBuffers(br_pixelmap *screen, br_pixelmap **colour_buffer
*colour_buffer = NULL;
}

if((tmp = BrPixelmapMatchTyped(screen, BR_PMMATCH_OFFSCREEN, BR_PMT_RGB_888)) == NULL)
if((tmp = BrPixelmapMatchTyped(screen, BR_PMMATCH_OFFSCREEN, BR_PMT_RGB_565)) == NULL)
return BRE_FAIL;

*colour_buffer = tmp;
Expand Down
12 changes: 8 additions & 4 deletions drivers/softrend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ add_library(softrend
template.h
timestmp.h
zsrmacro.h

"${CMAKE_CURRENT_BINARY_DIR}/drv.inc"

${ASM_FILES}
)

if(WIN32 AND MSVC AND (CMAKE_GENERATOR_PLATFORM STREQUAL "Win32"))
target_sources(softrend PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/drv.inc"
${ASM_FILES}
)
target_compile_definitions(softrend PRIVATE BR_SOFT_ENABLE_SUBDIVISION=1)
endif()

get_target_property(target_type softrend TYPE)
if(target_type STREQUAL SHARED_LIBRARY)
target_compile_definitions(softrend PRIVATE -DDEFINE_BR_ENTRY_POINT)
Expand Down
5 changes: 5 additions & 0 deletions drivers/softrend/drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ extern "C" {
#define BR_GEOMETRY_PRIMITIVES_PRIVATE
#define BR_GEOMETRY_LIGHTING_PRIVATE

#ifndef BR_SOFT_ENABLE_SUBDIVISION
#define BR_SOFT_ENABLE_SUBDIVISION 0
#endif


#ifndef _BRDDI_H_
#include "brddi.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion drivers/softrend/faceops.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static br_boolean subdivideCheck(brp_vertex *v0, brp_vertex *v1, brp_vertex *v2)
}
#endif

#if 1
#if 0
br_scalar z0,z1,z2,zt;

/*
Expand Down
2 changes: 2 additions & 0 deletions drivers/softrend/v1model.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ static void GEOMETRY_CALL V1Faces_GeometryFnsUpdate(struct br_geometry *self, st
} else
PrimBlockAdd(renderer, (brp_render_fn *)OpTriangleClip);

#if BR_SOFT_ENABLE_SUBDIVISION
/*
* Optional subdivision if the primitive requests it
*/
Expand All @@ -682,6 +683,7 @@ static void GEOMETRY_CALL V1Faces_GeometryFnsUpdate(struct br_geometry *self, st
PrimBlockOnScreenAdd(renderer, (brp_render_fn *)OpTriangleSubdivideOnScreen);
SubdivideSetThreshold(rend.block->subdivide_tolerance);
}
#endif
break;
}

Expand Down
3 changes: 1 addition & 2 deletions examples/brdemo/brdemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "brdemo.h"

#define USE_SOFT 0
#define USE_SOFT 1

/* begin hook */
void _BrBeginHook(void) // NOLINT(*-reserved-identifier)
Expand Down Expand Up @@ -156,7 +156,6 @@ int BrDemoRun(const char *title, br_uint_16 width, br_uint_16 height, const br_d
BRT_WINDOW_NAME_CSTR, title,
BRT_HIDPI_B, BR_TRUE,
#if !USE_SOFT
BRT_PIXEL_TYPE_U8, BR_PMT_RGB_888,
BRT_RESIZABLE_B, BR_TRUE,
BRT_OPENGL_B, BR_TRUE,
#endif
Expand Down
Binary file added examples/samples/rdemo/dat/earth16.pix
Binary file not shown.
Binary file added examples/samples/rdemo/dat/earth24.pix
Binary file not shown.
Binary file added examples/samples/rdemo/dat/planet16.pix
Binary file not shown.
Binary file added examples/samples/rdemo/dat/planet24.pix
Binary file not shown.
6 changes: 4 additions & 2 deletions examples/samples/rdemo/rdemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ static br_material *CreateMaterial(const char *identifier)
mat->ks = BR_UFRACTION(0.50);
mat->power = BR_SCALAR(20);

mat->flags = BR_MATF_GOURAUD | BR_MATF_LIGHT | BR_MATF_DISABLE_COLOUR_KEY;
mat->flags = BR_MATF_GOURAUD | BR_MATF_LIGHT | BR_MATF_DISABLE_COLOUR_KEY | BR_MATF_SUBDIVIDE;
mat->subdivide_tolerance = 1;
mat->map_transform = (br_matrix23){
{BR_VECTOR2(1, 0), BR_VECTOR2(0, 1), BR_VECTOR2(0, 0)}
};
Expand Down Expand Up @@ -123,9 +124,10 @@ br_error ReflectionInit(br_demo *demo)
* Complete definition of mirror texture. Note that the colour_map
* is a newly allocated pixelmap into which we'll render later.
*/
ref->mirror_pm = BrPixelmapMatchTypedSized(demo->colour_buffer, BR_PMMATCH_OFFSCREEN, demo->colour_buffer->type, 256, 256);
ref->mirror_pm = BrPixelmapMatchTypedSized(demo->colour_buffer, BR_PMMATCH_OFFSCREEN, BR_PMT_INDEX_8, 256, 256);
ref->mirror_pm->origin_x = (br_int_16)(ref->mirror_pm->width >> 1);
ref->mirror_pm->origin_y = (br_int_16)(ref->mirror_pm->height >> 1);
ref->mirror_pm->map = demo->palette;
BrMapAdd(ref->mirror_pm);

/*
Expand Down

0 comments on commit 3f98754

Please sign in to comment.