mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Differ between multiple particle_cloud modes
This commit is contained in:
parent
d0af444506
commit
d11f8122f3
82
raw/iw4/statemaps/wip_particle_cloud.sm
Normal file
82
raw/iw4/statemaps/wip_particle_cloud.sm
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// WIP
|
||||||
|
// Based on default
|
||||||
|
// Can merge back if possible
|
||||||
|
|
||||||
|
alphaTest
|
||||||
|
{
|
||||||
|
mtlAlphaTest == Always && mtlBlendOp == Add && mtlSrcBlend == SrcAlpha && mtlDestBlend == InvSrcAlpha: // Used
|
||||||
|
mtlAlphaTest == Always && mtlBlendOp == Add && mtlSrcBlend == SrcAlpha && mtlDestBlend == One: // Used
|
||||||
|
GT0;
|
||||||
|
default:
|
||||||
|
passthrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
blendFunc
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
passthrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
separateAlphaBlendFunc
|
||||||
|
{
|
||||||
|
mtlBlendOp == Disable: // Unused
|
||||||
|
Disable, One, Zero;
|
||||||
|
|
||||||
|
mtlAlphaTest == Disable: // Used
|
||||||
|
Add, Zero, One;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Add, InvDestAlpha, One;
|
||||||
|
}
|
||||||
|
|
||||||
|
cullFace
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
passthrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
depthTest
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
passthrough; // Always lessEqual, might be coincidence because it is default
|
||||||
|
}
|
||||||
|
|
||||||
|
depthWrite
|
||||||
|
{
|
||||||
|
mtlBlendOp == Disable:
|
||||||
|
Enable;
|
||||||
|
default:
|
||||||
|
Disable;
|
||||||
|
}
|
||||||
|
|
||||||
|
colorWrite
|
||||||
|
{
|
||||||
|
mtlPolygonOffset == 0:
|
||||||
|
Enable, Enable;
|
||||||
|
default:
|
||||||
|
Enable, Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
gammaWrite
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
passthrough; // Always false, might be coincidence because it is default
|
||||||
|
}
|
||||||
|
|
||||||
|
polygonOffset
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
passthrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
stencil
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
passthrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
wireframe
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
Disable;
|
||||||
|
}
|
@ -44,7 +44,7 @@
|
|||||||
#set PIXEL_SHADER "particle_cloud" + SPARK_SUFFIX + OUTDOOR_SUFFIX + SPOT_SUFFIX + SHADOW_SUFFIX + PREMUL_SUFFIX + ".hlsl"
|
#set PIXEL_SHADER "particle_cloud" + SPARK_SUFFIX + OUTDOOR_SUFFIX + SPOT_SUFFIX + SHADOW_SUFFIX + PREMUL_SUFFIX + ".hlsl"
|
||||||
|
|
||||||
{
|
{
|
||||||
stateMap "default";
|
stateMap "wip_particle_cloud";
|
||||||
|
|
||||||
vertexShader 3.0 "VERTEX_SHADER"
|
vertexShader 3.0 "VERTEX_SHADER"
|
||||||
{
|
{
|
||||||
|
@ -468,6 +468,8 @@ namespace IW4
|
|||||||
MATERIAL_TYPE_MODEL_UNLIT,
|
MATERIAL_TYPE_MODEL_UNLIT,
|
||||||
MATERIAL_TYPE_OBJECTIVE,
|
MATERIAL_TYPE_OBJECTIVE,
|
||||||
MATERIAL_TYPE_PARTICLE_CLOUD,
|
MATERIAL_TYPE_PARTICLE_CLOUD,
|
||||||
|
MATERIAL_TYPE_SPARK_CLOUD,
|
||||||
|
MATERIAL_TYPE_SPARK_FOUNTAIN,
|
||||||
MATERIAL_TYPE_SKY,
|
MATERIAL_TYPE_SKY,
|
||||||
MATERIAL_TYPE_TOOLS,
|
MATERIAL_TYPE_TOOLS,
|
||||||
MATERIAL_TYPE_UNLIT,
|
MATERIAL_TYPE_UNLIT,
|
||||||
@ -489,6 +491,8 @@ namespace IW4
|
|||||||
constexpr auto GDT_MATERIAL_TYPE_MODEL_UNLIT = "model unlit";
|
constexpr auto GDT_MATERIAL_TYPE_MODEL_UNLIT = "model unlit";
|
||||||
constexpr auto GDT_MATERIAL_TYPE_OBJECTIVE = "objective";
|
constexpr auto GDT_MATERIAL_TYPE_OBJECTIVE = "objective";
|
||||||
constexpr auto GDT_MATERIAL_TYPE_PARTICLE_CLOUD = "particle cloud";
|
constexpr auto GDT_MATERIAL_TYPE_PARTICLE_CLOUD = "particle cloud";
|
||||||
|
constexpr auto GDT_MATERIAL_TYPE_SPARK_CLOUD = "spark cloud";
|
||||||
|
constexpr auto GDT_MATERIAL_TYPE_SPARK_FOUNTAIN = "spark fountain";
|
||||||
constexpr auto GDT_MATERIAL_TYPE_SKY = "sky";
|
constexpr auto GDT_MATERIAL_TYPE_SKY = "sky";
|
||||||
constexpr auto GDT_MATERIAL_TYPE_TOOLS = "tools";
|
constexpr auto GDT_MATERIAL_TYPE_TOOLS = "tools";
|
||||||
constexpr auto GDT_MATERIAL_TYPE_UNLIT = "unlit";
|
constexpr auto GDT_MATERIAL_TYPE_UNLIT = "unlit";
|
||||||
@ -509,6 +513,8 @@ namespace IW4
|
|||||||
GDT_MATERIAL_TYPE_MODEL_UNLIT,
|
GDT_MATERIAL_TYPE_MODEL_UNLIT,
|
||||||
GDT_MATERIAL_TYPE_OBJECTIVE,
|
GDT_MATERIAL_TYPE_OBJECTIVE,
|
||||||
GDT_MATERIAL_TYPE_PARTICLE_CLOUD,
|
GDT_MATERIAL_TYPE_PARTICLE_CLOUD,
|
||||||
|
GDT_MATERIAL_TYPE_SPARK_CLOUD,
|
||||||
|
GDT_MATERIAL_TYPE_SPARK_FOUNTAIN,
|
||||||
GDT_MATERIAL_TYPE_SKY,
|
GDT_MATERIAL_TYPE_SKY,
|
||||||
GDT_MATERIAL_TYPE_TOOLS,
|
GDT_MATERIAL_TYPE_TOOLS,
|
||||||
GDT_MATERIAL_TYPE_UNLIT,
|
GDT_MATERIAL_TYPE_UNLIT,
|
||||||
|
@ -99,6 +99,14 @@ namespace IW4
|
|||||||
{
|
{
|
||||||
mtl_distortion_template();
|
mtl_distortion_template();
|
||||||
}
|
}
|
||||||
|
else if (materialType == GDT_MATERIAL_TYPE_SPARK_FOUNTAIN)
|
||||||
|
{
|
||||||
|
mtl_sparkfountain_template();
|
||||||
|
}
|
||||||
|
else if (materialType == GDT_MATERIAL_TYPE_SPARK_CLOUD)
|
||||||
|
{
|
||||||
|
mtl_sparkcloud_template();
|
||||||
|
}
|
||||||
else if (materialType == GDT_MATERIAL_TYPE_PARTICLE_CLOUD)
|
else if (materialType == GDT_MATERIAL_TYPE_PARTICLE_CLOUD)
|
||||||
{
|
{
|
||||||
mtl_particlecloud_template();
|
mtl_particlecloud_template();
|
||||||
@ -212,7 +220,22 @@ namespace IW4
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mtl_sparkfountain_template()
|
||||||
|
{
|
||||||
|
particlecloud_common_template("_sparkf");
|
||||||
|
}
|
||||||
|
|
||||||
|
void mtl_sparkcloud_template()
|
||||||
|
{
|
||||||
|
particlecloud_common_template("_spark");
|
||||||
|
}
|
||||||
|
|
||||||
void mtl_particlecloud_template()
|
void mtl_particlecloud_template()
|
||||||
|
{
|
||||||
|
particlecloud_common_template("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void particlecloud_common_template(const std::string& particleCloudSuffix)
|
||||||
{
|
{
|
||||||
refblend_template();
|
refblend_template();
|
||||||
sort_template();
|
sort_template();
|
||||||
@ -231,21 +254,23 @@ namespace IW4
|
|||||||
if (outdoorOnly)
|
if (outdoorOnly)
|
||||||
outdoorSuffix = "_outdoor";
|
outdoorSuffix = "_outdoor";
|
||||||
|
|
||||||
std::string addSuffix;
|
std::string blendFuncSuffix;
|
||||||
const auto blendFunc = ReadStringProperty("blendFunc");
|
const auto blendFunc = ReadStringProperty("blendFunc");
|
||||||
if (blendFunc == GDT_BLEND_FUNC_ADD || blendFunc == GDT_BLEND_FUNC_SCREEN_ADD)
|
if (blendFunc == GDT_BLEND_FUNC_ADD)
|
||||||
addSuffix = "_add";
|
blendFuncSuffix = "_add";
|
||||||
|
else if(blendFunc == GDT_BLEND_FUNC_SCREEN_ADD)
|
||||||
|
blendFuncSuffix = "_screen";
|
||||||
|
|
||||||
std::string spotSuffix;
|
std::string spotSuffix;
|
||||||
const auto useSpotLight = ReadBoolProperty("useSpotLight");
|
const auto useSpotLight = ReadBoolProperty("useSpotLight");
|
||||||
if (useSpotLight)
|
if (useSpotLight)
|
||||||
spotSuffix = "_spot";
|
spotSuffix = "_spot_sm";
|
||||||
|
|
||||||
if (outdoorOnly && useSpotLight)
|
if (outdoorOnly && useSpotLight)
|
||||||
throw GdtReadingException("Outdoor and spot aren't supported on particle cloud materials");
|
throw GdtReadingException("Outdoor and spot aren't supported on particle cloud materials");
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "particle_cloud" << outdoorSuffix << addSuffix << spotSuffix;
|
ss << "particle_cloud" << particleCloudSuffix << outdoorSuffix << blendFuncSuffix << spotSuffix;
|
||||||
SetTechniqueSet(ss.str());
|
SetTechniqueSet(ss.str());
|
||||||
|
|
||||||
const auto colorMapName = ReadStringProperty("colorMap");
|
const auto colorMapName = ReadStringProperty("colorMap");
|
||||||
|
@ -815,6 +815,69 @@ namespace IW4
|
|||||||
ExamineCommonUnlitTechsetInfo();
|
ExamineCommonUnlitTechsetInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExamineParticleCloudTechsetInfo()
|
||||||
|
{
|
||||||
|
const auto nameParts = GetTechsetNameParts(m_techset_info.m_techset_base_name);
|
||||||
|
bool inCustomName = false;
|
||||||
|
bool customNameStart = true;
|
||||||
|
std::ostringstream customNameStream;
|
||||||
|
|
||||||
|
for (auto iNamePart = nameParts.begin() + 2; iNamePart != nameParts.end(); ++iNamePart)
|
||||||
|
{
|
||||||
|
const auto& namePart = *iNamePart;
|
||||||
|
|
||||||
|
if (inCustomName)
|
||||||
|
{
|
||||||
|
if (customNameStart)
|
||||||
|
customNameStart = false;
|
||||||
|
else
|
||||||
|
customNameStream << "_";
|
||||||
|
customNameStream << namePart;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anything after a custom part is part of its custom name
|
||||||
|
if (namePart == "custom")
|
||||||
|
{
|
||||||
|
inCustomName = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (namePart == "falloff")
|
||||||
|
m_techset_info.m_falloff = true;
|
||||||
|
else if (namePart == "distfalloff")
|
||||||
|
m_techset_info.m_dist_falloff = true;
|
||||||
|
else if (namePart == "zfeather")
|
||||||
|
m_techset_info.m_zfeather = true;
|
||||||
|
else if (namePart == "nofog")
|
||||||
|
m_techset_info.m_no_fog = true;
|
||||||
|
else if (namePart == "nocast")
|
||||||
|
m_techset_info.m_no_cast_shadow = true;
|
||||||
|
else if (namePart == "spot")
|
||||||
|
m_techset_info.m_use_spot_light = true;
|
||||||
|
else if (namePart == "lin")
|
||||||
|
m_techset_info.m_effect_lin_flag = true;
|
||||||
|
else if (namePart == "outdoor")
|
||||||
|
m_techset_info.m_outdoor_only = true;
|
||||||
|
else if (namePart == "ua")
|
||||||
|
m_techset_info.m_uv_anim = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (namePart != "add" && namePart != "replace" && namePart != "blend" && namePart != "eyeoffset" && namePart != "screen" && namePart != "effect" && namePart != "unlit"
|
||||||
|
&& namePart != "multiply" && namePart != "sm" && namePart != "spark" && namePart != "sparkf")
|
||||||
|
{
|
||||||
|
std::cout << "Unknown name part \"" << namePart << "\"\n";
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inCustomName)
|
||||||
|
{
|
||||||
|
m_techset_info.m_gdt_custom_string = customNameStream.str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ExamineTechsetInfo()
|
void ExamineTechsetInfo()
|
||||||
{
|
{
|
||||||
if (!m_material->techniqueSet || !m_material->techniqueSet->name)
|
if (!m_material->techniqueSet || !m_material->techniqueSet->name)
|
||||||
@ -871,9 +934,20 @@ namespace IW4
|
|||||||
{
|
{
|
||||||
m_techset_info.m_gdt_material_type = MATERIAL_TYPE_DISTORTION;
|
m_techset_info.m_gdt_material_type = MATERIAL_TYPE_DISTORTION;
|
||||||
}
|
}
|
||||||
|
else if (m_techset_info.m_techset_base_name.rfind("particle_cloud_sparkf", 0) == 0)
|
||||||
|
{
|
||||||
|
m_techset_info.m_gdt_material_type = MATERIAL_TYPE_SPARK_FOUNTAIN;
|
||||||
|
ExamineParticleCloudTechsetInfo();
|
||||||
|
}
|
||||||
|
else if (m_techset_info.m_techset_base_name.rfind("particle_cloud_spark", 0) == 0)
|
||||||
|
{
|
||||||
|
m_techset_info.m_gdt_material_type = MATERIAL_TYPE_SPARK_CLOUD;
|
||||||
|
ExamineParticleCloudTechsetInfo();
|
||||||
|
}
|
||||||
else if (m_techset_info.m_techset_base_name.rfind("particle_cloud", 0) == 0)
|
else if (m_techset_info.m_techset_base_name.rfind("particle_cloud", 0) == 0)
|
||||||
{
|
{
|
||||||
m_techset_info.m_gdt_material_type = MATERIAL_TYPE_PARTICLE_CLOUD;
|
m_techset_info.m_gdt_material_type = MATERIAL_TYPE_PARTICLE_CLOUD;
|
||||||
|
ExamineParticleCloudTechsetInfo();
|
||||||
}
|
}
|
||||||
else if (m_techset_info.m_techset_base_name == "grain_overlay")
|
else if (m_techset_info.m_techset_base_name == "grain_overlay")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user