fix some skelatool bugs

This commit is contained in:
James Lambert 2022-09-08 20:19:47 -06:00
parent 591009adf1
commit cd5962ad74
3 changed files with 15 additions and 22 deletions

View file

@ -356,6 +356,9 @@
"type": "number",
"minimum": 0,
"maximum": 255
},
"bypassEffects": {
"type": "boolean"
}
},
"required": [

View file

@ -109,7 +109,11 @@ bool parseMaterialColor(const YAML::Node& node, PixelRGBAu8& color, ParseResult&
color.b = parseInteger(node["b"], output, 0, 255);
color.a = parseOptionalInteger(node["a"], output, 0, 255, 255);
if (output.mForcePallete.length() && output.mTargetCIBuffer) {
auto bypassNode = node["bypassEffects"];
bool bypass = bypassNode.IsDefined() && bypassNode.as<bool>();
if (!bypass && output.mForcePallete.length() && output.mTargetCIBuffer) {
std::shared_ptr<PalleteDefinition> pallete = gTextureCache.GetPallete(output.mForcePallete);
PixelIu8 colorindex = pallete->FindIndex(color);

View file

@ -2,7 +2,7 @@
#include "MaterialEnums.h"
void loadTextureFromAiMaterial(TextureCache& cache, Material& material, aiString filename, aiTextureMapMode textureMapMode, DisplayListSettings& settings) {
void loadTextureFromAiMaterial(TextureCache& cache, Material& material, aiString filename, DisplayListSettings& settings) {
G_IM_FMT fmt;
G_IM_SIZ siz;
TextureDefinition::DetermineIdealFormat(filename.C_Str(), fmt, siz);
@ -34,25 +34,11 @@ void loadTextureFromAiMaterial(TextureCache& cache, Material& material, aiString
state.sCoord.limit = (state.texture->Width() - 1) * 4;
state.tCoord.limit = (state.texture->Height() - 1) * 4;
if (textureMapMode == aiTextureMapMode_Wrap) {
state.sCoord.wrap = true;
state.tCoord.wrap = true;
state.sCoord.wrap = true;
state.tCoord.wrap = true;
state.sCoord.mirror = false;
state.tCoord.mirror = false;
} else if (textureMapMode == aiTextureMapMode_Mirror) {
state.sCoord.wrap = true;
state.tCoord.wrap = true;
state.sCoord.mirror = true;
state.tCoord.mirror = true;
} else {
state.sCoord.wrap = false;
state.tCoord.wrap = false;
state.sCoord.mirror = false;
state.tCoord.mirror = false;
}
state.sCoord.mirror = false;
state.tCoord.mirror = false;
}
#define TEXTURE_LIT "texture_lit"
@ -209,9 +195,9 @@ void fillMissingMaterials(TextureCache& cache, const aiScene* fromScene, Display
result->mExcludeFromOutut = false;
if (hasDiffuseTexture) {
loadTextureFromAiMaterial(cache, *result, diffuseFilename, diffuseTextureMapmode, settings);
loadTextureFromAiMaterial(cache, *result, diffuseFilename, settings);
} else if (hasEmmissiveTexture) {
loadTextureFromAiMaterial(cache, *result, emmisiveFilename, emitTextureMapmode, settings);
loadTextureFromAiMaterial(cache, *result, emmisiveFilename, settings);
} else if (hasEmmisiveColor) {
result->mState.usePrimitiveColor = true;
result->mState.primitiveColor.r = (uint8_t)(emmisiveColor.r * 255.0f);