Compare commits

..

4 Commits

Author SHA1 Message Date
Josh Pearson
986921cc9c Preserve low res textures
Any texture less than 64x64 keep original size.  Improves building LOD texture quality, and doesn't blow VRAM budget
2025-01-09 14:07:43 -07:00
Stefanos Kornilios Mitsis Poiitidis
2065c9a93f Merge branch 'skmp/fix-AllocateBoatWakeArray' into 'main'
Some checks failed
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Has been cancelled
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
Fix AllocateBoatWakeArray, it needs RpGeometryCreate with HAS_TRIANGLES

See merge request skmp/dca3-game!12
2025-01-06 11:46:50 +00:00
Stefanos Kornilios Mitsis Poiitidis
a2caa56275 Merge branch 'skmp/material-alpha-override-pt' into 'main'
Perform full blending for mat.a != 0xFF, should fade-in sprites (eg, Trees)

See merge request skmp/dca3-game!11
2025-01-06 11:41:11 +00:00
Stefanos Kornilios Mitsis Poiitidis
0a0a664428 Perform full blending for mat.a != 0xFF, should fade-in sprites (eg, Trees) 2025-01-05 15:40:18 +02:00
6 changed files with 35 additions and 33 deletions

Binary file not shown.

View File

@@ -83,25 +83,24 @@ OBJS_TEXCONV += \
# Add compilation units to this list to explicity compile them with
# -O3 optimizations, while the rest get the default (-Os) treatment
# to conserve RAM.
OBJS_O3 =
# \
# ../vendor/librw/src/dc/rwdc.o \
# ../src/core/World.o \
# ../src/collision/Collision.o \
# ../src/math/math.o \
# ../src/math/Matrix.o \
# ../src/math/Quaternion.o \
# ../src/math/Rect.o \
# ../src/math/Vector.o \
# ../vendor/librw/src/base.o \
# ../src/renderer/Shadows.o
OBJS_O3 = \
../vendor/librw/src/dc/rwdc.o \
../src/core/World.o \
../src/collision/Collision.o \
../src/math/math.o \
../src/math/Matrix.o \
../src/math/Quaternion.o \
../src/math/Rect.o \
../src/math/Vector.o \
../vendor/librw/src/base.o \
../src/renderer/Shadows.o
OBJS_NO_FAST_MATH = \
../src/core/Cam.o \
../src/core/Camera.o
KOS_CPPFLAGS += -mfsrra -mfsca -fbuiltin #-ffast-math -ffp-contract=fast \
KOS_CPPFLAGS += -fbuiltin -ffast-math -ffp-contract=fast \
-mfsrra -mfsca
ifdef KOS_BASE
include $(KOS_BASE)/Makefile.rules
@@ -114,9 +113,9 @@ DEPS = $(OBJS:.o=.d) $(OBJS_TEXCONV:.o:.d)
CXXFLAGS += $(if $(WITH_32MB),-O3,-Os) \
$(if $(WITH_IDE),-DWITH_IDE) \
$(if $(WITH_PROF),-DWITH_PROF=\"$(WITH_PROF)\") \
-MMD -MP -ffunction-sections -fdata-sections \
-MMD -MP -ffunction-sections -fdata-sections -ffast-math \
-fmerge-all-constants -fomit-frame-pointer -ml -std=gnu++20 \
-fno-exceptions -fno-rtti -fipa-pta -Wno-write-strings \
-fno-exceptions -fno-rtti -flto=auto -fipa-pta -Wno-write-strings \
-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion \
-Wno-multichar -Wno-unused-value -Wno-char-subscripts -Wno-reorder \
-Wno-unused-function -Wno-class-memaccess -fno-permissive \
@@ -156,7 +155,7 @@ $(OBJS_NO_FAST_MATH): %.o: %.cpp
$(TARGET): $(OBJS)
kos-c++ -o $(TARGET) $(OBJS) -Wl,--gc-sections -Wl,--as-needed -Wl,-Map,output.map \
$(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1
-flto=auto $(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1
@echo && echo && echo "*** Build Completed Successfully ***" && echo && echo
run: $(TARGET)

View File

@@ -27,7 +27,7 @@ CrossProduct(const CVector &v1, const CVector &v2)
CVector
Multiply3x3(const CMatrix &mat, const CVector &vec)
{
#if defined(DC_SH4) && 0
#ifdef DC_SH4
register float __x __asm__("fr12") = vec.x;
register float __y __asm__("fr13") = vec.y;
register float __z __asm__("fr14") = vec.z;
@@ -58,7 +58,7 @@ Multiply3x3(const CVector &vec, const CMatrix &mat)
CVector
operator*(const CMatrix &mat, const CVector &vec)
{
#if defined(DC_SH4) && 0
#ifdef DC_SH4
CVector out;
mat_load(reinterpret_cast<matrix_t *>(const_cast<CMatrix *>(&mat)));
mat_trans_single3_nodiv_nomod(vec.x, vec.y, vec.z, out.x, out.y, out.z);

View File

@@ -20,7 +20,7 @@ public:
// (0,1,0) means no rotation. So get right vector and its atan
__always_inline float Heading(void) const { return Atan2(-x, y); }
__always_inline float Magnitude(void) const {
#if defined(DC_SH4) && 0
#ifdef DC_SH4
float w;
vec3f_length(x, y, z, w);
return w;
@@ -29,7 +29,7 @@ public:
#endif
}
__always_inline float MagnitudeSqr(void) const {
#if defined(DC_SH4) && 0
#ifdef DC_SH4
return fipr_magnitude_sqr(x, y,z, 0.0f);
#else
return x*x + y*y + z*z;
@@ -118,7 +118,7 @@ inline CVector operator/(const CVector &left, float right)
__always_inline float
DotProduct(const CVector &v1, const CVector &v2)
{
#if defined(DC_SH4) && 0
#ifdef DC_SH4
return fipr(v1.x, v1.y, v1.z, 0.0f, v2.x, v2.y, v2.z, 0.0f);
#else
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
@@ -131,7 +131,7 @@ inline float
Distance(const CVector &v1, const CVector &v2)
{
float w;
#if defined(DC_SH4) && 0
#ifdef DC_SH4
vec3f_distance(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z, w);
return w;
#else

View File

@@ -43,7 +43,7 @@ __always_inline void TransformPoint(CVuVector &out, const CMatrix &mat, const CV
vmaddw.xyz vf06,vf05,vf00\n\
sqc2 vf06,0x0(%0)\n\
": : "r" (&out) , "r" (&mat) ,"r" (&in): "memory");
#elif defined(DC_SH4) && 0
#elif defined(DC_SH4)
mat_load(reinterpret_cast<matrix_t *>(const_cast<CMatrix *>(&mat)));
mat_trans_nodiv_nomod(in.x, in.y, in.z, out.x, out.y, out.z, out.y);
#else
@@ -70,7 +70,7 @@ __always_inline void TransformPoint(CVuVector &out, const CMatrix &mat, const Rw
vmaddw.xyz vf06,vf05,vf00\n\
sqc2 vf06,0x0(%0)\n\
": : "r" (&out) , "r" (&mat) ,"r" (&in): "memory");
#elif defined(DC_SH4) && 0
#elif defined(DC_SH4)
mat_load(reinterpret_cast<matrix_t *>(const_cast<CMatrix *>(&mat)));
mat_trans_nodiv_nomod(in.x, in.y, in.z, out.x, out.y, out.z, out.y);
#else
@@ -108,7 +108,7 @@ __always_inline void TransformPoints(CVuVector *out, int n, const CMatrix &mat,
sqc2 vf06,-0x10(%0)\n\
bnez %1,1b\n\
": : "r" (out) , "r" (n), "r" (&mat), "r" (in), "r" (stride): "memory");
#elif defined(DC_SH4) && 0
#elif defined(DC_SH4)
mat_load(reinterpret_cast<matrix_t *>(const_cast<CMatrix *>(&mat)));
mat_transform(reinterpret_cast<vector_t *>(const_cast<RwV3d *>(in)),
reinterpret_cast<vector_t *>(out),

View File

@@ -2462,7 +2462,8 @@ void* interpolateAndSubmit(void* dst, const void* src1, const void* src2, uint32
float16 v_u = v1_u + t * (v2_u - v1_u);
float16 v_v = v1_v + t * (v2_v - v1_v);
v->uv = v_v.raw | (v_u.raw << 16);
v->u = v_u.raw;
v->v = v_v.raw;
pvr_dr_commit(v);
v ++;
@@ -3293,6 +3294,8 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
for (int16_t n = 0; n < numMeshes; n++) {
bool doBlend = meshes[n].material->color.alpha != 255; // TODO: check all vertexes for alpha?
bool doBlendMaterial = doBlend;
bool textured = geo->numTexCoordSets && meshes[n].material->texture;
if (textured) {
doBlend |= Raster::formatHasAlpha(meshes[n].material->texture->raster->format);
@@ -3342,7 +3345,7 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
pvr_poly_cxt_t cxt;
int pvrList;
if (doBlend || isMatFX) {
if (doAlphaTest) {
if (doAlphaTest && !doBlendMaterial) {
pvrList = PVR_LIST_PT_POLY;
} else {
pvrList = PVR_LIST_TR_POLY;
@@ -3708,7 +3711,7 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
};
if (doBlend || isMatFX) {
if (doAlphaTest) {
if (doAlphaTest && !doBlendMaterial) {
ptCallbacks.emplace_back(std::move(renderCB));
} else {
blendCallbacks.emplace_back(std::move(renderCB));
@@ -3884,19 +3887,19 @@ imageFindRasterFormat(Image *img, int32 type,
;
if(downsampleMode >= HALF) {
if(height / 2 >= 16) {
if(height / 2 >= 64) {
height /= 2;
}
if(width / 2 >= 16) {
if(width / 2 >= 64) {
width /= 2;
}
}
if(downsampleMode >= QUARTER) {
if(height / 2 >= 16) {
if(height / 2 >= 32) {
height /= 2;
}
if(width / 2 >= 16) {
if(width / 2 >= 32) {
width /= 2;
}
}