summaryrefslogtreecommitdiffstats
path: root/src/entities/Entity.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-10-12 19:47:34 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-12 19:47:34 +0200
commit342da2430b5e0ca6ccc278c32ff104e1cfdb4113 (patch)
tree3285d50a4a687252b31c965afcde3a5a7a0d5cdc /src/entities/Entity.cpp
parentSampleManager (diff)
parentStreaming and cross-platform fixes (diff)
downloadre3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.tar
re3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.tar.gz
re3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.tar.bz2
re3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.tar.lz
re3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.tar.xz
re3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.tar.zst
re3-342da2430b5e0ca6ccc278c32ff104e1cfdb4113.zip
Diffstat (limited to 'src/entities/Entity.cpp')
-rw-r--r--src/entities/Entity.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index cf1dd9e7..2285c93f 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -1207,4 +1207,37 @@ bool CEntity::IsEntityOccluded(void) {
}
return false;
+}
+
+/*
+0x487A10 - SetAtomicAlphaCB
+0x4879E0 - SetClumpAlphaCB
+*/
+
+RpMaterial* SetAtomicAlphaCB(RpMaterial *material, void *data) {
+ ((RwRGBA*)RpMaterialGetColor(material))->alpha = (uint8)(uintptr)data;
+ return material;
+}
+
+RpAtomic* SetClumpAlphaCB(RpAtomic *atomic, void *data) {
+ RpGeometry *geometry = RpAtomicGetGeometry(atomic);
+ RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR);
+ RpGeometryForAllMaterials(geometry, SetAtomicAlphaCB, (void*)data);
+ return atomic;
+}
+
+void CEntity::SetRwObjectAlpha(int32 alpha) {
+ if (m_rwObject != nil) {
+ switch (RwObjectGetType(m_rwObject)) {
+ case rpATOMIC: {
+ RpGeometry *geometry = RpAtomicGetGeometry((RpAtomic*)m_rwObject);
+ RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR);
+ RpGeometryForAllMaterials(geometry, SetAtomicAlphaCB, (void*)alpha);
+ break;
+ }
+ case rpCLUMP:
+ RpClumpForAllAtomics((RpClump*)m_rwObject, SetClumpAlphaCB, (void*)alpha);
+ break;
+ }
+ }
} \ No newline at end of file