summaryrefslogtreecommitdiff
path: root/src/JSystem/J3DGraphBase/J3DTexture.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2025-09-04 07:56:59 -0700
committerGitHub <noreply@github.com>2025-09-04 17:56:59 +0300
commitb45a089e15d79821b07be020db628e01a49b1fd2 (patch)
tree948057548cc19b19d644bd4f300ca6434e6bff11 /src/JSystem/J3DGraphBase/J3DTexture.cpp
parentee8b843996f4d888903f8c125b95ec1af376877e (diff)
some J3D/misc cleanup (#2628)
* some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup
Diffstat (limited to 'src/JSystem/J3DGraphBase/J3DTexture.cpp')
-rw-r--r--src/JSystem/J3DGraphBase/J3DTexture.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/JSystem/J3DGraphBase/J3DTexture.cpp b/src/JSystem/J3DGraphBase/J3DTexture.cpp
index e4ff174899..ce4256b31d 100644
--- a/src/JSystem/J3DGraphBase/J3DTexture.cpp
+++ b/src/JSystem/J3DGraphBase/J3DTexture.cpp
@@ -1,30 +1,22 @@
-//
-// Generated By: dol2asm
-// Translation Unit: J3DTexture
-//
-
#include "JSystem/J3DGraphBase/J3DTexture.h"
-
-#include "dolphin/gx.h"
-#include "global.h"
+#include "JSystem/J3DAssert.h"
/* 8031204C-803121A4 30C98C 0158+00 0/0 1/1 0/0 .text loadGX__10J3DTextureCFUs11_GXTexMapID */
void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
- J3D_ASSERT(0, idx < mNum, "Error : range over.");
+ J3D_ASSERT_RANGE(29, idx < mNum);
ResTIMG* timg = getResTIMG(idx);
GXTexObj texObj;
+ GXTlutObj tlutObj;
if (!timg->indexTexture) {
GXInitTexObj(&texObj, ((u8*)timg) + timg->imageOffset, timg->width, timg->height,
(GXTexFmt)timg->format, (GXTexWrapMode)timg->wrapS, (GXTexWrapMode)timg->wrapT,
- (GXBool)timg->mipmapEnabled);
+ timg->mipmapEnabled);
} else {
- GXTlutObj tlutObj;
-
GXInitTexObjCI(&texObj, ((u8*)timg) + timg->imageOffset, timg->width, timg->height,
(GXCITexFmt)timg->format, (GXTexWrapMode)timg->wrapS,
- (GXTexWrapMode)timg->wrapT, (GXBool)timg->mipmapEnabled, (u32)texMapID);
+ (GXTexWrapMode)timg->wrapT, timg->mipmapEnabled, (u32)texMapID);
GXInitTlutObj(&tlutObj, ((u8*)timg) + timg->paletteOffset, (GXTlutFmt)timg->colorFormat,
timg->numColors);
GXLoadTlut(&tlutObj, texMapID);
@@ -34,31 +26,31 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
const f32 kLODBiasScale = 1.0f / 100.0f;
GXInitTexObjLOD(&texObj, (GXTexFilter)timg->minFilter, (GXTexFilter)timg->magFilter,
timg->minLOD * kLODClampScale, timg->maxLOD * kLODClampScale,
- timg->LODBias * kLODBiasScale, (GXBool)timg->biasClamp, (GXBool)timg->doEdgeLOD,
+ timg->LODBias * kLODBiasScale, timg->biasClamp, timg->doEdgeLOD,
(GXAnisotropy)timg->maxAnisotropy);
GXLoadTexObj(&texObj, texMapID);
}
/* 803121A4-8031221C 30CAE4 0078+00 1/1 0/0 0/0 .text entryNum__10J3DTextureFUs */
void J3DTexture::entryNum(u16 num) {
- J3D_ASSERT(79, num != 0, "Error : non-zero argument is specified 0.");
+ J3D_ASSERT_NONZEROARG(79, num != 0);
mNum = num;
- mpRes = new ResTIMG[num]();
- J3D_ASSERT(83, mpRes != 0, "Error : allocate memory.");
+ mpRes = new ResTIMG[num];
+ J3D_ASSERT_ALLOCMEM(83, mpRes != NULL);
- for (s32 i = 0; i < mNum; i++) {
+ for (int i = 0; i < mNum; i++) {
mpRes[i].paletteOffset = 0;
mpRes[i].imageOffset = 0;
}
}
/* 8031221C-80312488 30CB5C 026C+00 0/0 1/1 0/0 .text addResTIMG__10J3DTextureFUsPC7ResTIMG */
-void J3DTexture::addResTIMG(u16 newNum, ResTIMG const* newRes) {
+void J3DTexture::addResTIMG(u16 newNum, const ResTIMG* newRes) {
if (newNum == 0)
return;
- J3D_ASSERT(105, newRes != 0, "Error : null pointer.");
+ J3D_ASSERT_NULLPTR(105, newRes != 0);
u16 oldNum = mNum;
ResTIMG* oldRes = mpRes;