mirror of
https://github.com/minetest/irrlicht.git
synced 2025-02-22 13:50:25 +01:00
RGBA
This commit is contained in:
parent
66c9f3c3c5
commit
162f45327c
@ -239,6 +239,68 @@ std::tuple<bool, std::string> CB3DJSONMeshFileLoader::readChunkBRUS() {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
for (auto reference = brus.begin(); reference != brus.end(); ++reference) {
|
for (auto reference = brus.begin(); reference != brus.end(); ++reference) {
|
||||||
|
|
||||||
|
// b stands for brush.
|
||||||
|
json b = *reference;
|
||||||
|
|
||||||
|
if (!b.is_object()) {
|
||||||
|
return {false, "BRUS: Element " + std::to_string(index) + " is not an object."};
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is still quite strange. Maybe just make this a reference because it would be pointing to the same memory address.
|
||||||
|
Materials.push_back(SB3dMaterial());
|
||||||
|
SB3dMaterial& B3DMaterial = Materials.getLast();
|
||||||
|
|
||||||
|
//* Red.
|
||||||
|
if (b.contains("red") && b["red"].is_number()) {
|
||||||
|
B3DMaterial.red = b["red"];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!b.contains("red")) {
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") is missing \"red\"."};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") \"red\" is not a number."};
|
||||||
|
}
|
||||||
|
|
||||||
|
//* Green.
|
||||||
|
if (b.contains("green") && b["green"].is_number()) {
|
||||||
|
B3DMaterial.green = b["green"];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!b.contains("green")) {
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") is missing \"green\"."};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") \"green\" is not a number."};
|
||||||
|
}
|
||||||
|
|
||||||
|
//* Blue.
|
||||||
|
if (b.contains("blue") && b["blue"].is_number()) {
|
||||||
|
B3DMaterial.blue = b["blue"];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!b.contains("blue")) {
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") is missing \"blue\"."};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") \"blue\" is not a number."};
|
||||||
|
}
|
||||||
|
|
||||||
|
//* Alpha.
|
||||||
|
if (b.contains("alpha") && b["alpha"].is_number()) {
|
||||||
|
B3DMaterial.alpha = b["alpha"];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!b.contains("alpha")) {
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") is missing \"alpha\"."};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {false, "BRUS: Element (" + std::to_string(index) + ") \"alpha\" is not a number."};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ private:
|
|||||||
// Fields.
|
// Fields.
|
||||||
CSkinnedMesh* AnimatedMesh;
|
CSkinnedMesh* AnimatedMesh;
|
||||||
core::array<SB3dTexture> Textures;
|
core::array<SB3dTexture> Textures;
|
||||||
|
core::array<SB3dMaterial> Materials;
|
||||||
/*
|
/*
|
||||||
Quick note about JSON.
|
Quick note about JSON.
|
||||||
This is static memory, it's a static memory address so I do not think
|
This is static memory, it's a static memory address so I do not think
|
||||||
|
Loading…
x
Reference in New Issue
Block a user