mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 22:50:06 -04:00
Running out of ideas for G3DUtility
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef EGG_G3D_UTILITY_H
|
||||
#define EGG_G3D_UTILITY_H
|
||||
|
||||
#include "egg/egg_types.h"
|
||||
#include "nw4r/g3d/g3d_scnmdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resmat.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
@@ -20,23 +21,41 @@ public:
|
||||
/* 0x03 */ s8 texCoordId;
|
||||
};
|
||||
|
||||
static u32 SetTexture(
|
||||
nw4r::g3d::ResMat resMat, nw4r::g3d::ScnMdl::CopiedMatAccess *param_2, const char *name, GXTexObj *texObj,
|
||||
bool copy, SetTextureResult *pResult, int param_7, int param_8
|
||||
struct SearchResult {
|
||||
/* 0x00 */ u16 nodeIdx;
|
||||
/* 0x04 */ const char *name;
|
||||
};
|
||||
|
||||
static u16 SetTexture(
|
||||
nw4r::g3d::ResMat resMat, nw4r::g3d::ScnMdl::CopiedMatAccess *param_2, const char *name, const GXTexObj *texObj,
|
||||
bool copy, SetTextureResult *pResult, int maxNumResults, int param_8
|
||||
);
|
||||
|
||||
static void setUpLightSet(nw4r::g3d::LightSetting &, nw4r::g3d::ResAnmScn, int);
|
||||
static int ApplyLightMat(nw4r::g3d::ResMdl mdl, const char *prefix);
|
||||
|
||||
static nw4r::math::MTX34 *GetWorldMtxArray(int, int);
|
||||
static bool setUpLightSet(nw4r::g3d::LightSetting &, nw4r::g3d::ResAnmScn, int);
|
||||
|
||||
static int searchStringResNode(nw4r::g3d::ResMdl, const char *, u16 *, u32);
|
||||
static int searchStringResMat(nw4r::g3d::ResMdl, const char *, u16 *, u32);
|
||||
static int searchStringResTexPlttInfo(nw4r::g3d::ResMdl, const char *, u16 *, u32);
|
||||
static void *BumpAlloc(u32 size, u32 align);
|
||||
static void ResetBumpAlloc() {
|
||||
sOffset = 0;
|
||||
}
|
||||
|
||||
typedef int (*MdlSearch)(nw4r::g3d::ResMdl, const char *, u16 *, u32);
|
||||
static void create(u32 size, Heap *pHeap);
|
||||
|
||||
static int searchStringResNode(nw4r::g3d::ResMdl mdl, const char * name, bool exactMatch, SearchResult *pResults, int maxNumResults);
|
||||
static int searchStringResMat(nw4r::g3d::ResMdl mdl, const char * name, bool exactMatch, SearchResult *pResults, int maxNumResults);
|
||||
static int searchStringResTexPlttInfo(nw4r::g3d::ResMdl mdl, const char * name, bool exactMatch, SearchResult *pResults, int maxNumResults);
|
||||
|
||||
typedef int (*MdlSearch)(nw4r::g3d::ResMdl mdl, const char * name, bool exactMatch, SearchResult *pResults, int maxNumResults);
|
||||
|
||||
private:
|
||||
static void defaultTexMtxFunc(nw4r::math::MTX34 *pMtx, s8 camRef, s8 lightRef);
|
||||
|
||||
static MEMAllocator *sAllocator;
|
||||
static void *sBuf;
|
||||
static u32 sSize;
|
||||
static u32 sOffset;
|
||||
static u8 sId;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
bool setBinaryToTexture(const void *data);
|
||||
bool deleteTexture(int idx);
|
||||
|
||||
int replaceModelTextures(nw4r::g3d::ResMdl) const;
|
||||
int replaceModelTexture(int, nw4r::g3d::ResMdl) const;
|
||||
u16 replaceModelTextures(nw4r::g3d::ResMdl) const;
|
||||
u16 replaceModelTexture(int, nw4r::g3d::ResMdl) const;
|
||||
void drawAndCaptureTexture(f32, f32, f32, f32);
|
||||
void frameReset();
|
||||
void correctLightObject();
|
||||
|
||||
@@ -246,6 +246,13 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
void Disable(u32 id) {
|
||||
ref().flag =
|
||||
ref().flag &
|
||||
~((TexSrt::FLAG_ANM_EXISTS | TexSrt::FLAG_SCALE_ONE | TexSrt::FLAG_ROT_ZERO | TexSrt::FLAG_TRANS_ZERO)
|
||||
<< (id * TexSrt::NUM_OF_FLAGS));
|
||||
}
|
||||
|
||||
bool IsExist(u32 id) const {
|
||||
if (IsValid()) {
|
||||
return ptr()->flag & (1 << id * TexSrt::NUM_OF_FLAGS);
|
||||
@@ -513,6 +520,35 @@ private:
|
||||
void BindPltt_(const ResPltt pltt, ResTlutObj tlutObj);
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* ResTexPlttInfoOffsetData
|
||||
*
|
||||
******************************************************************************/
|
||||
struct ResTexPlttInfoOffsetData {
|
||||
u32 size; // at 0x0
|
||||
u8 _0x04[4]; // at 0x4
|
||||
struct Unk {
|
||||
s32 texPlltInfo;
|
||||
u8 _0x00[4];
|
||||
} data[1]; // at 0x8
|
||||
};
|
||||
|
||||
class ResTexPlttInfoOffset : public ResCommon<ResTexPlttInfoOffsetData> {
|
||||
public:
|
||||
NW4R_G3D_RESOURCE_FUNC_DEF(ResTexPlttInfoOffset);
|
||||
|
||||
ResTexPlttInfo GetPllt(int idx) const {
|
||||
const ResTexPlttInfoOffsetData &r = ref();
|
||||
return ofs_to_obj<ResTexPlttInfo>(r.data[idx].texPlltInfo);
|
||||
}
|
||||
|
||||
u32 GetNumData() const {
|
||||
const ResTexPlttInfoOffsetData &r = ref();
|
||||
return r.size;
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* ResMatFur
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
ResShp GetResShp(u32 idx) const;
|
||||
u32 GetResShpNumEntries() const;
|
||||
|
||||
ResTexPlttInfo GetResTexPlttInfoOffsetFromTexName(int idx) const;
|
||||
ResTexPlttInfoOffset GetResTexPlttInfoOffsetFromTexName(int idx) const;
|
||||
u32 GetResTexPlttInfoOffsetFromTexNameNumEntries() const;
|
||||
|
||||
ResMdlInfo GetResMdlInfo() {
|
||||
|
||||
@@ -67,8 +67,8 @@ struct ResNodeData : ResNodeDataTypedef {
|
||||
math::_VEC3 scale; // at 0x20
|
||||
math::_VEC3 rot; // at 0x2C
|
||||
math::_VEC3 translate; // at 0x38
|
||||
math::_VEC3 volume_min; // at 0x44
|
||||
math::_VEC3 volume_max; // at 0x50
|
||||
math::_VEC3 volume_min; // at 0x44
|
||||
math::_VEC3 volume_max; // at 0x50
|
||||
s32 toParentNode; // at 0x5C
|
||||
s32 toChildNode; // at 0x60
|
||||
s32 toNextSibling; // at 0x64
|
||||
@@ -95,6 +95,11 @@ public:
|
||||
return ResName(NULL);
|
||||
}
|
||||
|
||||
const char *GetName() const {
|
||||
const ResNodeData &r = ref();
|
||||
return ofs_to_ptr<const char>(r.name);
|
||||
}
|
||||
|
||||
u32 GetID() const {
|
||||
if (IsValid()) {
|
||||
return ptr()->id;
|
||||
@@ -145,12 +150,12 @@ public:
|
||||
|
||||
// not in the dwarf
|
||||
const math::VEC3 &GetBoundsMin() const {
|
||||
return *(const math::VEC3*)&ref().volume_min;
|
||||
return *(const math::VEC3 *)&ref().volume_min;
|
||||
}
|
||||
|
||||
// not in the dwarf
|
||||
const math::VEC3 &GetBoundsMax() const {
|
||||
return *(const math::VEC3*)&ref().volume_max;
|
||||
return *(const math::VEC3 *)&ref().volume_max;
|
||||
}
|
||||
|
||||
ResNode GetParentNode() {
|
||||
|
||||
@@ -44,6 +44,9 @@ void GXGetTexObjLODAll(
|
||||
u8 *biasClampEnable, u8 *edgeLODEnable, GXAnisotropy *anisotropy
|
||||
);
|
||||
|
||||
void GXInitTexObjFilter(GXTexObj *, GXTexFilter minFilter, GXTexFilter magFilter);
|
||||
void GXInitTexObjWrapMode(GXTexObj *, GXTexWrapMode wrapS, GXTexWrapMode wrapT);
|
||||
|
||||
void GXSetTexCoordScaleManually(GXTexCoordID, GXBool, u16, u16);
|
||||
void GXSetTexCoordBias(GXTexCoordID, GXBool, GXBool);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user