mirror of https://github.com/AxioDL/metaforce.git
SIMD refactor
This commit is contained in:
parent
e1fa938127
commit
7c7da6671a
|
@ -2,9 +2,9 @@
|
|||
<code_scheme name="Project" version="173">
|
||||
<Objective-C>
|
||||
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
|
||||
<option name="NAMESPACE_BRACE_PLACEMENT" value="5" />
|
||||
<option name="FUNCTION_BRACE_PLACEMENT" value="5" />
|
||||
<option name="BLOCK_BRACE_PLACEMENT" value="5" />
|
||||
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
|
||||
<option name="INDENT_CLASS_MEMBERS" value="2" />
|
||||
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
|
||||
<option name="SPACE_WITHIN_TEMPLATE_DOUBLE_GT" value="false" />
|
||||
<option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
|
||||
<option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
|
||||
|
@ -12,36 +12,17 @@
|
|||
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
|
||||
</Objective-C>
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="hpp" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
<codeStyleSettings language="ObjectiveC">
|
||||
<option name="BRACE_STYLE" value="5" />
|
||||
<option name="CLASS_BRACE_STYLE" value="5" />
|
||||
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||
</project>
|
|
@ -115,8 +115,7 @@ else()
|
|||
message(STATUS "Building with x87 Vector ISA")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\
|
||||
-Wno-multichar -fno-exceptions -fno-rtti -Wno-narrowing -Wno-nullability-completeness -Werror=return-type")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -fno-exceptions -fno-rtti -Werror")
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin")
|
||||
|
|
|
@ -39,50 +39,53 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& ch
|
|||
static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div)
|
||||
{
|
||||
float q = M_PIF / 2.0f / float(div);
|
||||
zeus::simd_floats f(quat.simd);
|
||||
return
|
||||
{
|
||||
{
|
||||
atInt32(std::asin(quat.v4.vec[1]) / q),
|
||||
atInt32(std::asin(quat.v4.vec[2]) / q),
|
||||
atInt32(std::asin(quat.v4.vec[3]) / q),
|
||||
atInt32(std::asin(f[1]) / q),
|
||||
atInt32(std::asin(f[2]) / q),
|
||||
atInt32(std::asin(f[3]) / q),
|
||||
},
|
||||
(quat.v4.vec[0] < 0.f) ? true : false
|
||||
(f[0] < 0.f)
|
||||
};
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = M_PIF / 2.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
athena::simd_floats f = {
|
||||
0.0f,
|
||||
std::sin(v.v[0] * q),
|
||||
std::sin(v.v[1] * q),
|
||||
std::sin(v.v[2] * q),
|
||||
};
|
||||
retval.v4.vec[0] = std::sqrt(std::max((1.0f -
|
||||
(retval.v4.vec[1] * retval.v4.vec[1] +
|
||||
retval.v4.vec[2] * retval.v4.vec[2] +
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0f));
|
||||
retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0];
|
||||
f[0] = std::sqrt(std::max((1.0f -
|
||||
(f[1] * f[1] +
|
||||
f[2] * f[2] +
|
||||
f[3] * f[3])), 0.0f));
|
||||
f[0] = v.w ? -f[0] : f[0];
|
||||
Value retval;
|
||||
retval.simd.copy_from(f);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation_3(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = 1.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
athena::simd_floats f = {
|
||||
0.0f,
|
||||
v.v[0] * q,
|
||||
v.v[1] * q,
|
||||
v.v[2] * q,
|
||||
};
|
||||
retval.v4.vec[0] = std::sqrt(std::max((1.0f -
|
||||
(retval.v4.vec[1] * retval.v4.vec[1] +
|
||||
retval.v4.vec[2] * retval.v4.vec[2] +
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0f));
|
||||
retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0];
|
||||
f[0] = std::sqrt(std::max((1.0f -
|
||||
(f[1] * f[1] +
|
||||
f[2] * f[2] +
|
||||
f[3] * f[3])), 0.0f));
|
||||
f[0] = v.w ? -f[0] : f[0];
|
||||
Value retval;
|
||||
retval.simd.copy_from(f);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -337,9 +340,10 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
++it)
|
||||
{
|
||||
const Value* key = &*it;
|
||||
maxTransVal = std::max(maxTransVal, std::fabs(key->v3.vec[0]));
|
||||
maxTransVal = std::max(maxTransVal, std::fabs(key->v3.vec[1]));
|
||||
maxTransVal = std::max(maxTransVal, std::fabs(key->v3.vec[2]));
|
||||
zeus::simd_floats f(key->simd);
|
||||
maxTransVal = std::max(maxTransVal, std::fabs(f[0]));
|
||||
maxTransVal = std::max(maxTransVal, std::fabs(f[1]));
|
||||
maxTransVal = std::max(maxTransVal, std::fabs(f[2]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -350,9 +354,10 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
++it)
|
||||
{
|
||||
const Value* key = &*it;
|
||||
maxScaleVal = std::max(maxScaleVal, std::fabs(key->v3.vec[0]));
|
||||
maxScaleVal = std::max(maxScaleVal, std::fabs(key->v3.vec[1]));
|
||||
maxScaleVal = std::max(maxScaleVal, std::fabs(key->v3.vec[2]));
|
||||
zeus::simd_floats f(key->simd);
|
||||
maxScaleVal = std::max(maxScaleVal, std::fabs(f[0]));
|
||||
maxScaleVal = std::max(maxScaleVal, std::fabs(f[1]));
|
||||
maxScaleVal = std::max(maxScaleVal, std::fabs(f[2]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -383,17 +388,19 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
}
|
||||
case Channel::Type::Translation:
|
||||
{
|
||||
chan.i = {atInt32((*kit)[0].v3.vec[0] / transMultOut),
|
||||
atInt32((*kit)[0].v3.vec[1] / transMultOut),
|
||||
atInt32((*kit)[0].v3.vec[2] / transMultOut)};
|
||||
zeus::simd_floats f((*kit)[0].simd);
|
||||
chan.i = {atInt32(f[0] / transMultOut),
|
||||
atInt32(f[1] / transMultOut),
|
||||
atInt32(f[2] / transMultOut)};
|
||||
initVals.push_back(chan.i);
|
||||
break;
|
||||
}
|
||||
case Channel::Type::Scale:
|
||||
{
|
||||
chan.i = {atInt32((*kit)[0].v3.vec[0] / scaleMultOut),
|
||||
atInt32((*kit)[0].v3.vec[1] / scaleMultOut),
|
||||
atInt32((*kit)[0].v3.vec[2] / scaleMultOut)};
|
||||
zeus::simd_floats f((*kit)[0].simd);
|
||||
chan.i = {atInt32(f[0] / scaleMultOut),
|
||||
atInt32(f[1] / scaleMultOut),
|
||||
atInt32(f[2] / scaleMultOut)};
|
||||
initVals.push_back(chan.i);
|
||||
break;
|
||||
}
|
||||
|
@ -431,9 +438,10 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
it != kit->end();
|
||||
++it)
|
||||
{
|
||||
QuantizedValue cur = {atInt32(it->v3.vec[0] / transMultOut),
|
||||
atInt32(it->v3.vec[1] / transMultOut),
|
||||
atInt32(it->v3.vec[2] / transMultOut)};
|
||||
zeus::simd_floats f(it->simd);
|
||||
QuantizedValue cur = {atInt32(f[0] / transMultOut),
|
||||
atInt32(f[1] / transMultOut),
|
||||
atInt32(f[2] / transMultOut)};
|
||||
chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0)));
|
||||
chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1)));
|
||||
chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2)));
|
||||
|
@ -447,9 +455,10 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
it != kit->end();
|
||||
++it)
|
||||
{
|
||||
QuantizedValue cur = {atInt32(it->v3.vec[0] / scaleMultOut),
|
||||
atInt32(it->v3.vec[1] / scaleMultOut),
|
||||
atInt32(it->v3.vec[2] / scaleMultOut)};
|
||||
zeus::simd_floats f(it->simd);
|
||||
QuantizedValue cur = {atInt32(f[0] / scaleMultOut),
|
||||
atInt32(f[1] / scaleMultOut),
|
||||
atInt32(f[2] / scaleMultOut)};
|
||||
chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0)));
|
||||
chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1)));
|
||||
chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2)));
|
||||
|
@ -490,9 +499,10 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
}
|
||||
case Channel::Type::Translation:
|
||||
{
|
||||
QuantizedValue cur = {atInt32(val.v3.vec[0] / transMultOut),
|
||||
atInt32(val.v3.vec[1] / transMultOut),
|
||||
atInt32(val.v3.vec[2] / transMultOut)};
|
||||
zeus::simd_floats f(val.simd);
|
||||
QuantizedValue cur = {atInt32(f[0] / transMultOut),
|
||||
atInt32(f[1] / transMultOut),
|
||||
atInt32(f[2] / transMultOut)};
|
||||
quantize(newData.get(), chan.q[0], cur[0] - last[0]);
|
||||
quantize(newData.get(), chan.q[1], cur[1] - last[1]);
|
||||
quantize(newData.get(), chan.q[2], cur[2] - last[2]);
|
||||
|
@ -501,9 +511,10 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
}
|
||||
case Channel::Type::Scale:
|
||||
{
|
||||
QuantizedValue cur = {atInt32(val.v3.vec[0] / scaleMultOut),
|
||||
atInt32(val.v3.vec[1] / scaleMultOut),
|
||||
atInt32(val.v3.vec[2] / scaleMultOut)};
|
||||
zeus::simd_floats f(val.simd);
|
||||
QuantizedValue cur = {atInt32(f[0] / scaleMultOut),
|
||||
atInt32(f[1] / scaleMultOut),
|
||||
atInt32(f[2] / scaleMultOut)};
|
||||
quantize(newData.get(), chan.q[0], cur[0] - last[0]);
|
||||
quantize(newData.get(), chan.q[1], cur[1] - last[1]);
|
||||
quantize(newData.get(), chan.q[2], cur[2] - last[2]);
|
||||
|
|
|
@ -6,33 +6,22 @@
|
|||
namespace DataSpec::DNAANIM
|
||||
{
|
||||
|
||||
union Value
|
||||
struct Value
|
||||
{
|
||||
atVec3f v3;
|
||||
atVec4f v4;
|
||||
Value(atVec3f v) : v3(v) {}
|
||||
Value(atVec4f v) : v4(v) {}
|
||||
Value(float x, float y, float z)
|
||||
{
|
||||
v3.vec[0] = x;
|
||||
v3.vec[1] = y;
|
||||
v3.vec[2] = z;
|
||||
v4.vec[3] = 0.0;
|
||||
}
|
||||
Value(float w, float x, float y, float z)
|
||||
{
|
||||
v4.vec[0] = w;
|
||||
v4.vec[1] = x;
|
||||
v4.vec[2] = y;
|
||||
v4.vec[3] = z;
|
||||
}
|
||||
athena::simd<float> simd;
|
||||
Value() = default;
|
||||
Value(const athena::simd<float>& s) : simd(s) {}
|
||||
Value(const atVec3f& v) : simd(v.simd) {}
|
||||
Value(const atVec4f& v) : simd(v.simd) {}
|
||||
Value(float x, float y, float z) : simd(x, y, z, 0.f) {}
|
||||
Value(float w, float x, float y, float z) : simd(w, x, y, z) {}
|
||||
};
|
||||
struct QuantizedValue
|
||||
{
|
||||
atInt32 v[4];
|
||||
atInt32& operator[] (size_t idx)
|
||||
{return v[idx];}
|
||||
const atInt32& operator[] (size_t idx) const
|
||||
atInt32 operator[] (size_t idx) const
|
||||
{return v[idx];}
|
||||
|
||||
int qFrom(const QuantizedValue& other, size_t idx) const
|
||||
|
|
|
@ -86,7 +86,7 @@ void AROTBuilder::Node::addChild(int level, int minChildren, const std::vector<z
|
|||
return;
|
||||
}
|
||||
else if (childIndices.size() < minChildren || level == AROT_MAX_LEVEL ||
|
||||
std::max(extents.x, std::max(extents.y, extents.z)) < AROT_MIN_SUBDIV)
|
||||
std::max(extents.x(), std::max(extents.y(), extents.z())) < AROT_MIN_SUBDIV)
|
||||
{
|
||||
typeOut = BspNodeType::Leaf;
|
||||
return;
|
||||
|
@ -103,21 +103,21 @@ void AROTBuilder::Node::addChild(int level, int minChildren, const std::vector<z
|
|||
}
|
||||
|
||||
/* Unsubdivide minimum axis dimensions */
|
||||
if (extents.x < AROT_MIN_SUBDIV)
|
||||
if (extents.x() < AROT_MIN_SUBDIV)
|
||||
{
|
||||
mergeSets(0, 1);
|
||||
mergeSets(4, 5);
|
||||
mergeSets(2, 3);
|
||||
mergeSets(6, 7);
|
||||
}
|
||||
if (extents.y < AROT_MIN_SUBDIV)
|
||||
if (extents.y() < AROT_MIN_SUBDIV)
|
||||
{
|
||||
mergeSets(0, 2);
|
||||
mergeSets(1, 3);
|
||||
mergeSets(4, 6);
|
||||
mergeSets(5, 7);
|
||||
}
|
||||
if (extents.z < AROT_MIN_SUBDIV)
|
||||
if (extents.z() < AROT_MIN_SUBDIV)
|
||||
{
|
||||
mergeSets(0, 4);
|
||||
mergeSets(1, 5);
|
||||
|
|
|
@ -17,7 +17,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
|||
case BabeDeadLight::LightType::LocalAmbient2:
|
||||
os.format("bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n"
|
||||
"bg_node.inputs[1].default_value = %f\n",
|
||||
light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||
light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.q / 8.f);
|
||||
return;
|
||||
case BabeDeadLight::LightType::Directional:
|
||||
|
@ -27,8 +27,8 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
|||
"lamp_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
|
||||
"lamp.shadow_method = '%s'\n"
|
||||
"\n", s, l, light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||
light.direction.vec[0], light.direction.vec[1], light.direction.vec[2],
|
||||
"\n", s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.direction.simd[0], light.direction.simd[1], light.direction.simd[2],
|
||||
light.castShadows ? "RAY_SHADOW" : "NOSHADOW");
|
||||
return;
|
||||
case BabeDeadLight::LightType::Custom:
|
||||
|
@ -37,7 +37,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
|||
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
||||
"lamp.shadow_soft_size = 1.0\n"
|
||||
"lamp.shadow_method = '%s'\n"
|
||||
"\n", s, l, light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||
"\n", s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.castShadows ? "RAY_SHADOW" : "NOSHADOW");
|
||||
break;
|
||||
case BabeDeadLight::LightType::Spot:
|
||||
|
@ -50,9 +50,9 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
|||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
|
||||
"lamp.shadow_soft_size = 0.5\n"
|
||||
"lamp.shadow_method = '%s'\n"
|
||||
"\n", s, l, light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||
"\n", s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
zeus::degToRad(light.spotCutoff),
|
||||
light.direction.vec[0], light.direction.vec[1], light.direction.vec[2],
|
||||
light.direction.simd[0], light.direction.simd[1], light.direction.simd[2],
|
||||
light.castShadows ? "RAY_SHADOW" : "NOSHADOW");
|
||||
break;
|
||||
default: return;
|
||||
|
@ -73,8 +73,8 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
|||
"lamp_obj.location = (%f,%f,%f)\n"
|
||||
"bpy.context.scene.objects.link(lamp_obj)\n"
|
||||
"\n", s, light.lightType, light.q / 8.f,
|
||||
light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||
light.position.vec[0], light.position.vec[1], light.position.vec[2]);
|
||||
light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.position.simd[0], light.position.simd[1], light.position.simd[2]);
|
||||
|
||||
switch (light.falloff)
|
||||
{
|
||||
|
@ -150,9 +150,9 @@ void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::blender:
|
|||
lightOut.color = lightIn.color;
|
||||
lightOut.spotCutoff = zeus::radToDeg(lightIn.spotCutoff);
|
||||
lightOut.castShadows = lightIn.shadow;
|
||||
lightOut.position.vec[0] = lightIn.sceneXf[0].vec[3];
|
||||
lightOut.position.vec[1] = lightIn.sceneXf[1].vec[3];
|
||||
lightOut.position.vec[2] = lightIn.sceneXf[2].vec[3];
|
||||
lightOut.position.simd[0] = lightIn.sceneXf[0].simd[3];
|
||||
lightOut.position.simd[1] = lightIn.sceneXf[1].simd[3];
|
||||
lightOut.position.simd[2] = lightIn.sceneXf[2].simd[3];
|
||||
|
||||
zeus::CTransform lightXf(&lightIn.sceneXf[0]);
|
||||
lightOut.direction = (lightXf.basis.transposed() * zeus::CVector3f(0.f, 0.f, -1.f)).normalized();
|
||||
|
|
|
@ -786,7 +786,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
|
|||
positions.push_back(reader.readVec3fBig());
|
||||
const atVec3f& pos = positions.back();
|
||||
os.format("vert = bm.verts.new((%f,%f,%f))\n",
|
||||
pos.vec[0], pos.vec[1], pos.vec[2]);
|
||||
pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||
if (rp.first)
|
||||
{
|
||||
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||
|
@ -802,7 +802,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
|
|||
{
|
||||
const atVec3f& pos = positions[i];
|
||||
os.format("vert = bm.verts.new((%f,%f,%f))\n",
|
||||
pos.vec[0], pos.vec[1], pos.vec[2]);
|
||||
pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||
if (rp.first)
|
||||
{
|
||||
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||
|
@ -836,9 +836,9 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
|
|||
size_t normCount = secSizes[s] / 12;
|
||||
for (size_t i=0 ; i<normCount ; ++i)
|
||||
{
|
||||
atVec3f norm = reader.readVec3fBig();
|
||||
const atVec3f norm = reader.readVec3fBig();
|
||||
os.format("norm_list.append((%f,%f,%f))\n",
|
||||
norm.vec[0], norm.vec[1], norm.vec[2]);
|
||||
norm.simd[0], norm.simd[1], norm.simd[2]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -855,9 +855,9 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
|
|||
size_t uvCount = secSizes[s] / 8;
|
||||
for (size_t i=0 ; i<uvCount ; ++i)
|
||||
{
|
||||
atVec2f uv = reader.readVec2fBig();
|
||||
const atVec2f uv = reader.readVec2fBig();
|
||||
os.format("uv_list.append((%f,%f))\n",
|
||||
uv.vec[0], uv.vec[1]);
|
||||
uv.simd[0], uv.simd[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1461,7 +1461,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
|||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int tmpV = int(norm.vec[i] * 16384.f);
|
||||
int tmpV = int(norm.simd[i] * 16384.f);
|
||||
tmpV = zeus::clamp(-32768, tmpV, 32767);
|
||||
writer.writeInt16Big(atInt16(tmpV));
|
||||
}
|
||||
|
@ -1992,7 +1992,7 @@ bool WriteMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::Proje
|
|||
{
|
||||
for (int i=0 ; i<2 ; ++i)
|
||||
{
|
||||
int tmpV = int(v.val.vec[i] * 32768.f);
|
||||
int tmpV = int(v.val.simd[i] * 32768.f);
|
||||
tmpV = zeus::clamp(-32768, tmpV, 32767);
|
||||
w.writeInt16Big(atInt16(tmpV));
|
||||
}
|
||||
|
|
|
@ -41,20 +41,23 @@ template <> inline void DNAColor::Enumerate<BigDNA::ReadYaml>(typename ReadYaml:
|
|||
size_t count;
|
||||
if (auto v = _r.enterSubVector(nullptr, count))
|
||||
{
|
||||
r = (count >= 1) ? _r.readFloat(nullptr) : 0.f;
|
||||
g = (count >= 2) ? _r.readFloat(nullptr) : 0.f;
|
||||
b = (count >= 3) ? _r.readFloat(nullptr) : 0.f;
|
||||
a = (count >= 4) ? _r.readFloat(nullptr) : 0.f;
|
||||
zeus::simd_floats f;
|
||||
f[0] = (count >= 1) ? _r.readFloat(nullptr) : 0.f;
|
||||
f[1] = (count >= 2) ? _r.readFloat(nullptr) : 0.f;
|
||||
f[2] = (count >= 3) ? _r.readFloat(nullptr) : 0.f;
|
||||
f[3] = (count >= 4) ? _r.readFloat(nullptr) : 0.f;
|
||||
mSimd.copy_from(f);
|
||||
}
|
||||
}
|
||||
template <> inline void DNAColor::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& _w)
|
||||
{
|
||||
if (auto v = _w.enterSubVector(nullptr))
|
||||
{
|
||||
_w.writeFloat(nullptr, r);
|
||||
_w.writeFloat(nullptr, g);
|
||||
_w.writeFloat(nullptr, b);
|
||||
_w.writeFloat(nullptr, a);
|
||||
zeus::simd_floats f(mSimd);
|
||||
_w.writeFloat(nullptr, f[0]);
|
||||
_w.writeFloat(nullptr, f[1]);
|
||||
_w.writeFloat(nullptr, f[2]);
|
||||
_w.writeFloat(nullptr, f[3]);
|
||||
}
|
||||
}
|
||||
template <> inline void DNAColor::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& _s)
|
||||
|
|
|
@ -15,10 +15,10 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
|||
os << "material_index = []\n"
|
||||
"col_bm = bmesh.new()\n";
|
||||
for (const atVec3f& vert : db.verts)
|
||||
os.format("col_bm.verts.new((%f,%f,%f))\n",
|
||||
vert.vec[0],
|
||||
vert.vec[1],
|
||||
vert.vec[2]);
|
||||
{
|
||||
zeus::simd_floats f(vert.simd);
|
||||
os.format("col_bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
os << "col_bm.verts.ensure_lookup_table()\n";
|
||||
|
||||
|
|
|
@ -185,6 +185,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn,
|
|||
if (mapa.version < 5)
|
||||
{
|
||||
const MAPA::MappableObjectMP1_2* moMP12 = static_cast<const MAPA::MappableObjectMP1_2*>(mo.get());
|
||||
zeus::simd_floats mtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
moMP12->transformMtx[i].simd.copy_to(mtxF[i]);
|
||||
os.format("obj = bpy.data.objects.new('MAPOBJ_%02d', None)\n"
|
||||
"bpy.context.scene.objects.link(obj)\n"
|
||||
"obj.retro_mappable_type = %d\n"
|
||||
|
@ -197,15 +200,18 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn,
|
|||
"obj.rotation_quaternion = mtxd[1]\n"
|
||||
"obj.scale = mtxd[2]\n",
|
||||
moIdx, moMP12->type, RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId,
|
||||
moMP12->transformMtx[0].vec[0], moMP12->transformMtx[0].vec[1], moMP12->transformMtx[0].vec[2], moMP12->transformMtx[0].vec[3],
|
||||
moMP12->transformMtx[1].vec[0], moMP12->transformMtx[1].vec[1], moMP12->transformMtx[1].vec[2], moMP12->transformMtx[1].vec[3],
|
||||
moMP12->transformMtx[2].vec[0], moMP12->transformMtx[2].vec[1], moMP12->transformMtx[2].vec[2], moMP12->transformMtx[2].vec[3]);
|
||||
mtxF[0][0], mtxF[0][1], mtxF[0][2], mtxF[0][3],
|
||||
mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3],
|
||||
mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]);
|
||||
++moIdx;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
const MAPA::MappableObjectMP3* moMP3 = static_cast<const MAPA::MappableObjectMP3*>(mo.get());
|
||||
zeus::simd_floats mtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
moMP3->transformMtx[i].simd.copy_to(mtxF[i]);
|
||||
os.format("obj = bpy.data.objects.new('MAPOBJ_%02d', None)\n"
|
||||
"bpy.context.scene.objects.link(obj)\n"
|
||||
"obj.retro_mappable_type = %d\n"
|
||||
|
@ -218,9 +224,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn,
|
|||
"obj.rotation_quaternion = mtxd[1]\n"
|
||||
"obj.scale = mtxd[2]\n",
|
||||
moIdx, moMP3->type, RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId,
|
||||
moMP3->transformMtx[0].vec[0], moMP3->transformMtx[0].vec[1], moMP3->transformMtx[0].vec[2], moMP3->transformMtx[0].vec[3],
|
||||
moMP3->transformMtx[1].vec[0], moMP3->transformMtx[1].vec[1], moMP3->transformMtx[1].vec[2], moMP3->transformMtx[1].vec[3],
|
||||
moMP3->transformMtx[2].vec[0], moMP3->transformMtx[2].vec[1], moMP3->transformMtx[2].vec[2], moMP3->transformMtx[2].vec[3]);
|
||||
mtxF[0][0], mtxF[0][1], mtxF[0][2], mtxF[0][3],
|
||||
mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3],
|
||||
mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]);
|
||||
++moIdx;
|
||||
continue;
|
||||
}
|
||||
|
@ -232,8 +238,10 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn,
|
|||
|
||||
/* Read in verts */
|
||||
for (const atVec3f& vert : mapa.vertices)
|
||||
os.format("bm.verts.new((%f,%f,%f))\n",
|
||||
vert.vec[0], vert.vec[1], vert.vec[2]);
|
||||
{
|
||||
zeus::simd_floats f(vert.simd);
|
||||
os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
|
||||
}
|
||||
os << "bm.verts.ensure_lookup_table()\n";
|
||||
|
||||
/* Read in surfaces */
|
||||
|
|
|
@ -47,6 +47,10 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn,
|
|||
{
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(wld.mlvl);
|
||||
const MAPU::Transform& wldXf = wld.transform;
|
||||
zeus::simd_floats wldXfF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
wldXf.xf[i].simd.copy_to(wldXfF[i]);
|
||||
zeus::simd_floats hexColorF(wld.hexColor.mSimd);
|
||||
os.format("wldObj = bpy.data.objects.new('%s', None)\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
|
@ -57,14 +61,17 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn,
|
|||
"wldObj.retro_mapworld_color = (%f, %f, %f, %f)\n"
|
||||
"wldObj.retro_mapworld_path = '''%s'''\n"
|
||||
"bpy.context.scene.objects.link(wldObj)\n", wld.name.c_str(),
|
||||
wldXf.xf[0].vec[0], wldXf.xf[0].vec[1], wldXf.xf[0].vec[2], wldXf.xf[0].vec[3],
|
||||
wldXf.xf[1].vec[0], wldXf.xf[1].vec[1], wldXf.xf[1].vec[2], wldXf.xf[1].vec[3],
|
||||
wldXf.xf[2].vec[0], wldXf.xf[2].vec[1], wldXf.xf[2].vec[2], wldXf.xf[2].vec[3],
|
||||
wld.hexColor.r, wld.hexColor.g, wld.hexColor.b, wld.hexColor.a,
|
||||
wldXfF[0][0], wldXfF[0][1], wldXfF[0][2], wldXfF[0][3],
|
||||
wldXfF[1][0], wldXfF[1][1], wldXfF[1][2], wldXfF[1][3],
|
||||
wldXfF[2][0], wldXfF[2][1], wldXfF[2][2], wldXfF[2][3],
|
||||
hexColorF[0], hexColorF[1], hexColorF[2], hexColorF[3],
|
||||
path.getParentPath().getRelativePathUTF8().data());
|
||||
int idx = 0;
|
||||
for (const MAPU::Transform& hexXf : wld.hexTransforms)
|
||||
{
|
||||
zeus::simd_floats hexXfF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
hexXf.xf[i].simd.copy_to(hexXfF[i]);
|
||||
os.format("obj = bpy.data.objects.new('%s_%d', hexMesh)\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
|
@ -75,9 +82,9 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn,
|
|||
"bpy.context.scene.objects.link(obj)\n"
|
||||
"obj.parent = wldObj\n",
|
||||
wld.name.c_str(), idx++,
|
||||
hexXf.xf[0].vec[0], hexXf.xf[0].vec[1], hexXf.xf[0].vec[2], hexXf.xf[0].vec[3],
|
||||
hexXf.xf[1].vec[0], hexXf.xf[1].vec[1], hexXf.xf[1].vec[2], hexXf.xf[1].vec[3],
|
||||
hexXf.xf[2].vec[0], hexXf.xf[2].vec[1], hexXf.xf[2].vec[2], hexXf.xf[2].vec[3]);
|
||||
hexXfF[0][0], hexXfF[0][1], hexXfF[0][2], hexXfF[0][3],
|
||||
hexXfF[1][0], hexXfF[1][1], hexXfF[1][2], hexXfF[1][3],
|
||||
hexXfF[2][0], hexXfF[2][1], hexXfF[2][2], hexXfF[2][3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
|
|||
hecl::SystemUTF8Conv areaDirName(*mreaEntry->unique.m_areaName);
|
||||
|
||||
os.AABBToBMesh(area.aabb[0], area.aabb[1]);
|
||||
zeus::simd_floats xfMtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
area.transformMtx[i].simd.copy_to(xfMtxF[i]);
|
||||
os.format("box_mesh = bpy.data.meshes.new('''%s''')\n"
|
||||
"bm.to_mesh(box_mesh)\n"
|
||||
"bm.free()\n"
|
||||
|
@ -56,9 +59,9 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
|
|||
"box.rotation_quaternion = mtxd[1]\n"
|
||||
"box.scale = mtxd[2]\n",
|
||||
areaDirName.str().data(),
|
||||
area.transformMtx[0].vec[0], area.transformMtx[0].vec[1], area.transformMtx[0].vec[2], area.transformMtx[0].vec[3],
|
||||
area.transformMtx[1].vec[0], area.transformMtx[1].vec[1], area.transformMtx[1].vec[2], area.transformMtx[1].vec[3],
|
||||
area.transformMtx[2].vec[0], area.transformMtx[2].vec[1], area.transformMtx[2].vec[2], area.transformMtx[2].vec[3]);
|
||||
xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], xfMtxF[0][3],
|
||||
xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], xfMtxF[1][3],
|
||||
xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], xfMtxF[2][3]);
|
||||
|
||||
/* Insert dock planes */
|
||||
int dockIdx = 0;
|
||||
|
@ -72,7 +75,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
|
|||
int idx = 0;
|
||||
for (const atVec3f& pv : dock.planeVerts)
|
||||
{
|
||||
zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
||||
const zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
||||
os.format("bm.verts.new((%f,%f,%f))\n"
|
||||
"bm.verts.ensure_lookup_table()\n",
|
||||
pvRel[0], pvRel[1], pvRel[2]);
|
||||
|
@ -88,7 +91,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
|
|||
"bm.free()\n"
|
||||
"dockObj.parent = box\n";
|
||||
os.format("dockObj.location = (%f,%f,%f)\n",
|
||||
pvAvg[0], pvAvg[1], pvAvg[2]);
|
||||
float(pvAvg[0]), float(pvAvg[1]), float(pvAvg[2]));
|
||||
++dockIdx;
|
||||
}
|
||||
++areaIdx;
|
||||
|
|
|
@ -59,9 +59,9 @@ static FittedOBB BuildFromCovarianceMatrix(gmm::dense_matrix<float>& C,
|
|||
r.normalize(); u.normalize(), f.normalize();
|
||||
|
||||
// set the rotation matrix using the eigvenvectors
|
||||
ret.xf.basis[0][0]=r.x; ret.xf.basis[1][0]=u.x; ret.xf.basis[2][0]=f.x;
|
||||
ret.xf.basis[0][1]=r.y; ret.xf.basis[1][1]=u.y; ret.xf.basis[2][1]=f.y;
|
||||
ret.xf.basis[0][2]=r.z; ret.xf.basis[1][2]=u.z; ret.xf.basis[2][2]=f.z;
|
||||
ret.xf.basis[0] = r;
|
||||
ret.xf.basis[1] = u;
|
||||
ret.xf.basis[2] = f;
|
||||
|
||||
// now build the bounding box extents in the rotated frame
|
||||
zeus::CVector3f minim(1e10f, 1e10f, 1e10f), maxim(-1e10f, -1e10f, -1e10f);
|
||||
|
@ -115,11 +115,11 @@ static FittedOBB FitOBB(const ColMesh& mesh, const std::vector<int>& index)
|
|||
Am += Ai;
|
||||
|
||||
// these bits set the c terms to Am*E[xx], Am*E[xy], Am*E[xz]....
|
||||
cxx += ( 9.0*mui.x*mui.x + p.x*p.x + q.x*q.x + r.x*r.x )*(Ai/12.0);
|
||||
cxy += ( 9.0*mui.x*mui.y + p.x*p.y + q.x*q.y + r.x*r.y )*(Ai/12.0);
|
||||
cxz += ( 9.0*mui.x*mui.z + p.x*p.z + q.x*q.z + r.x*r.z )*(Ai/12.0);
|
||||
cyy += ( 9.0*mui.y*mui.y + p.y*p.y + q.y*q.y + r.y*r.y )*(Ai/12.0);
|
||||
cyz += ( 9.0*mui.y*mui.z + p.y*p.z + q.y*q.z + r.y*r.z )*(Ai/12.0);
|
||||
cxx += ( 9.0*mui.x()*mui.x() + p.x()*p.x() + q.x()*q.x() + r.x()*r.x() )*(Ai/12.0);
|
||||
cxy += ( 9.0*mui.x()*mui.y() + p.x()*p.y() + q.x()*q.y() + r.x()*r.y() )*(Ai/12.0);
|
||||
cxz += ( 9.0*mui.x()*mui.z() + p.x()*p.z() + q.x()*q.z() + r.x()*r.z() )*(Ai/12.0);
|
||||
cyy += ( 9.0*mui.y()*mui.y() + p.y()*p.y() + q.y()*q.y() + r.y()*r.y() )*(Ai/12.0);
|
||||
cyz += ( 9.0*mui.y()*mui.z() + p.y()*p.z() + q.y()*q.z() + r.y()*r.z() )*(Ai/12.0);
|
||||
}
|
||||
|
||||
if (zeus::close_enough(Am, 0.f))
|
||||
|
@ -131,8 +131,8 @@ static FittedOBB FitOBB(const ColMesh& mesh, const std::vector<int>& index)
|
|||
cxx /= Am; cxy /= Am; cxz /= Am; cyy /= Am; cyz /= Am; czz /= Am;
|
||||
|
||||
// now subtract off the E[x]*E[x], E[x]*E[y], ... terms
|
||||
cxx -= mu.x*mu.x; cxy -= mu.x*mu.y; cxz -= mu.x*mu.z;
|
||||
cyy -= mu.y*mu.y; cyz -= mu.y*mu.z; czz -= mu.z*mu.z;
|
||||
cxx -= mu.x()*mu.x(); cxy -= mu.x()*mu.y(); cxz -= mu.x()*mu.z();
|
||||
cyy -= mu.y()*mu.y(); cyz -= mu.y()*mu.z(); czz -= mu.z()*mu.z();
|
||||
|
||||
// now build the covariance matrix
|
||||
C(0,0)=cxx; C(0,1)=cxy; C(0,2)=cxz;
|
||||
|
@ -169,7 +169,7 @@ static std::unique_ptr<Node> RecursiveMakeNode(const ColMesh& mesh, const std::v
|
|||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
n->xf[i] = zeus::CVector4f{obb.xf.basis[i]};
|
||||
n->xf[i].vec[3] = obb.xf.origin[i];
|
||||
n->xf[i].simd[3] = float(obb.xf.origin[i]);
|
||||
}
|
||||
n->halfExtent = obb.he;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
|||
{
|
||||
size_t idx = 0;
|
||||
for (const DNAANIM::Value& val : rotKeys)
|
||||
fixedRotKeys[idx++][c] = val.v4.vec[c];
|
||||
fixedRotKeys[idx++][c] = val.simd[c];
|
||||
}
|
||||
|
||||
for (zeus::CQuaternion& rot : fixedRotKeys)
|
||||
|
@ -77,7 +77,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
|||
{
|
||||
size_t idx = 0;
|
||||
for (const DNAANIM::Value& val : transKeys)
|
||||
fixedTransKeys[idx++][c] = val.v3.vec[c];
|
||||
fixedTransKeys[idx++][c] = val.simd[c];
|
||||
}
|
||||
|
||||
for (zeus::CVector3f& t : fixedTransKeys)
|
||||
|
@ -281,7 +281,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec4fBig((*kit++).v4);
|
||||
writer.writeVec4fBig(atVec4f{(*kit++).simd});
|
||||
if (bone.second)
|
||||
{
|
||||
transKeyCount += head.keyCount;
|
||||
|
@ -299,7 +299,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec3fBig((*kit++).v3);
|
||||
writer.writeVec3fBig(atVec3f{(*kit++).simd});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,9 +655,9 @@ ANIM::ANIM(const BlenderAction& act,
|
|||
zeus::CQuaternion q(key.rotation.val);
|
||||
q = rig.restoreRotation(newChan.id, q);
|
||||
if (sign == 0.f)
|
||||
sign = q.w < 0.f ? -1.f : 1.f;
|
||||
sign = q.w() < 0.f ? -1.f : 1.f;
|
||||
q *= sign;
|
||||
rotVals.emplace_back(q.w, q.x, q.y, q.z);
|
||||
rotVals.emplace_back(q.mSimd);
|
||||
}
|
||||
|
||||
if (chan.attrMask & 0x2)
|
||||
|
@ -674,7 +674,7 @@ ANIM::ANIM(const BlenderAction& act,
|
|||
{
|
||||
zeus::CVector3f pos(key.position.val);
|
||||
pos = rig.restorePosition(newChan.id, pos, true);
|
||||
transVals.emplace_back(pos.x, pos.y, pos.z);
|
||||
transVals.emplace_back(pos.mSimd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,15 +64,19 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& c
|
|||
cinfId.toUint32());
|
||||
|
||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
||||
{
|
||||
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
||||
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
||||
os.format("bone = arm.edit_bones.new('%s')\n"
|
||||
"bone.head = (%f,%f,%f)\n"
|
||||
"bone.tail = (%f,%f,%f)\n"
|
||||
"bone.use_inherit_scale = False\n"
|
||||
"arm_bone_table[%u] = bone\n",
|
||||
getBoneNameFromId(bone.m_origBone.id)->c_str(),
|
||||
bone.m_origBone.origin.vec[0], bone.m_origBone.origin.vec[1], bone.m_origBone.origin.vec[2],
|
||||
bone.m_tail[0], bone.m_tail[1], bone.m_tail[2],
|
||||
originF[0], originF[1], originF[2],
|
||||
tailF[0], tailF[1], tailF[2],
|
||||
bone.m_origBone.id);
|
||||
}
|
||||
|
||||
for (const Bone& bone : bones)
|
||||
if (bone.parentId != 2)
|
||||
|
|
|
@ -1304,38 +1304,38 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
|||
mode = Mode::Scroll;
|
||||
if (gameArgs.size() < 2)
|
||||
Log.report(logvisor::Fatal, "Mode2 UV anim requires 2 vector arguments");
|
||||
vals[0] = gameArgs[0].vec[0];
|
||||
vals[1] = gameArgs[0].vec[1];
|
||||
vals[2] = gameArgs[1].vec[0];
|
||||
vals[3] = gameArgs[1].vec[1];
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[0].simd[1];
|
||||
vals[2] = gameArgs[1].simd[0];
|
||||
vals[3] = gameArgs[1].simd[1];
|
||||
}
|
||||
else if (!gameFunction.compare("RetroUVMode3Node"))
|
||||
{
|
||||
mode = Mode::Rotation;
|
||||
if (gameArgs.size() < 2)
|
||||
Log.report(logvisor::Fatal, "Mode3 UV anim requires 2 arguments");
|
||||
vals[0] = gameArgs[0].vec[0];
|
||||
vals[1] = gameArgs[1].vec[0];
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
}
|
||||
else if (!gameFunction.compare("RetroUVMode4Node"))
|
||||
{
|
||||
mode = Mode::HStrip;
|
||||
if (gameArgs.size() < 4)
|
||||
Log.report(logvisor::Fatal, "Mode4 UV anim requires 4 arguments");
|
||||
vals[0] = gameArgs[0].vec[0];
|
||||
vals[1] = gameArgs[1].vec[0];
|
||||
vals[2] = gameArgs[2].vec[0];
|
||||
vals[3] = gameArgs[3].vec[0];
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
vals[2] = gameArgs[2].simd[0];
|
||||
vals[3] = gameArgs[3].simd[0];
|
||||
}
|
||||
else if (!gameFunction.compare("RetroUVMode5Node"))
|
||||
{
|
||||
mode = Mode::VStrip;
|
||||
if (gameArgs.size() < 4)
|
||||
Log.report(logvisor::Fatal, "Mode5 UV anim requires 4 arguments");
|
||||
vals[0] = gameArgs[0].vec[0];
|
||||
vals[1] = gameArgs[1].vec[0];
|
||||
vals[2] = gameArgs[2].vec[0];
|
||||
vals[3] = gameArgs[3].vec[0];
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
vals[2] = gameArgs[2].simd[0];
|
||||
vals[3] = gameArgs[3].simd[0];
|
||||
}
|
||||
else if (!gameFunction.compare("RetroUVMode6NodeN"))
|
||||
mode = Mode::Model;
|
||||
|
@ -1344,8 +1344,8 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
|||
mode = Mode::CylinderEnvironment;
|
||||
if (gameArgs.size() < 2)
|
||||
Log.report(logvisor::Fatal, "Mode7 UV anim requires 2 arguments");
|
||||
vals[0] = gameArgs[0].vec[0];
|
||||
vals[1] = gameArgs[1].vec[0];
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
}
|
||||
else
|
||||
Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str());
|
||||
|
|
|
@ -289,7 +289,7 @@ void PAKBridge::addPATHToMREA(PAKRouter<PAKBridge>& pakRouter,
|
|||
}
|
||||
}
|
||||
|
||||
static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f};
|
||||
static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}};
|
||||
|
||||
void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID32, zeus::CMatrix4f>& addTo,
|
||||
|
|
|
@ -366,15 +366,20 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
switch(info->type)
|
||||
{
|
||||
case LITEInfo::ELightType::LocalAmbient:
|
||||
{
|
||||
zeus::simd_floats colorF(w.header.color.simd);
|
||||
os.format("bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n"
|
||||
"bg_node.inputs[1].default_value = %f\n",
|
||||
w.header.color.vec[0], w.header.color.vec[1], w.header.color.vec[2],
|
||||
colorF[0], colorF[1], colorF[2],
|
||||
info->distQ / 8.0);
|
||||
break;
|
||||
}
|
||||
case LITEInfo::ELightType::Spot:
|
||||
case LITEInfo::ELightType::Directional:
|
||||
os << "angle = Quaternion((1.0, 0.0, 0.0), math.radians(90.0))\n";
|
||||
default:
|
||||
{
|
||||
zeus::simd_floats colorF(w.header.color.simd);
|
||||
os.format("lamp = bpy.data.lamps.new(name='%s', type='POINT')\n"
|
||||
"lamp.color = (%f, %f, %f)\n"
|
||||
"lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n"
|
||||
|
@ -387,7 +392,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
"lamp.retro_light_index = %d\n"
|
||||
"binding = lamp\n",
|
||||
w.header.name.c_str(),
|
||||
w.header.color.vec[0], w.header.color.vec[1], w.header.color.vec[2],
|
||||
colorF[0], colorF[1], colorF[2],
|
||||
info->distC, info->distL, info->distQ,
|
||||
info->angC, info->angL, info->angQ, info->loadedIdx);
|
||||
if (info->type == LITEInfo::ELightType::Spot)
|
||||
|
@ -397,6 +402,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
else if (info->type == LITEInfo::ELightType::Directional)
|
||||
os << "lamp.type = 'HEMI'\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (w.type == SBIG('IMGP'))
|
||||
|
@ -456,10 +462,8 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
ti = 2;
|
||||
else
|
||||
ti = i;
|
||||
os.format("verts.append(bm.verts.new((%f,%f,%f)))\n",
|
||||
info->quadCoords[ti].vec[0],
|
||||
info->quadCoords[ti].vec[1],
|
||||
info->quadCoords[ti].vec[2]);
|
||||
zeus::simd_floats f(info->quadCoords[ti].simd);
|
||||
os.format("verts.append(bm.verts.new((%f,%f,%f)))\n", f[0], f[1], f[2]);
|
||||
}
|
||||
os << "bm.faces.new(verts)\n"
|
||||
"bm.loops.layers.uv.new('UV')\n"
|
||||
|
@ -473,9 +477,8 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
ti = 2;
|
||||
else
|
||||
ti = i;
|
||||
os.format("bm.verts[%d].link_loops[0][bm.loops.layers.uv[0]].uv = (%f,%f)\n", i,
|
||||
info->uvCoords[ti].vec[0],
|
||||
info->uvCoords[ti].vec[1]);
|
||||
zeus::simd_floats f(info->uvCoords[ti].simd);
|
||||
os.format("bm.verts[%d].link_loops[0][bm.loops.layers.uv[0]].uv = (%f,%f)\n", i, f[0], f[1]);
|
||||
}
|
||||
os.format("binding = bpy.data.meshes.new('%s')\n"
|
||||
"bm.to_mesh(binding)\n"
|
||||
|
@ -485,6 +488,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
}
|
||||
}
|
||||
|
||||
zeus::simd_floats colorF(w.header.color.simd);
|
||||
os.format("frme_obj = bpy.data.objects.new(name='%s', object_data=binding)\n"
|
||||
"frme_obj.pass_index = %d\n"
|
||||
"parentName = '%s'\n"
|
||||
|
@ -507,7 +511,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
w.header.defaultVisible ? "True" : "False",
|
||||
w.header.defaultActive ? "True" : "False",
|
||||
w.header.cullFaces ? "True" : "False",
|
||||
w.header.color.vec[0], w.header.color.vec[1], w.header.color.vec[2], w.header.color.vec[3],
|
||||
colorF[0], colorF[1], colorF[2], colorF[3],
|
||||
w.header.modelDrawFlags,
|
||||
w.isWorker ? "True" : "False",
|
||||
w.workerId);
|
||||
|
@ -541,12 +545,10 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
using PANEInfo = Widget::PANEInfo;
|
||||
if (PANEInfo* info = static_cast<PANEInfo*>(w.widgetInfo.get()))
|
||||
{
|
||||
zeus::simd_floats f(info->scaleCenter.simd);
|
||||
os.format("frme_obj.retro_pane_dimensions = (%f,%f)\n"
|
||||
"frme_obj.retro_pane_scale_center = (%f,%f,%f)\n",
|
||||
info->xDim, info->zDim,
|
||||
info->scaleCenter.vec[0],
|
||||
info->scaleCenter.vec[1],
|
||||
info->scaleCenter.vec[2]);
|
||||
info->xDim, info->zDim, f[0], f[1], f[2]);
|
||||
}
|
||||
}
|
||||
else if (w.type == SBIG('TXPN'))
|
||||
|
@ -559,6 +561,10 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
if (frme.version >= 1)
|
||||
jpFontPath = pakRouter.getWorking(info->jpnFont, true);
|
||||
|
||||
zeus::simd_floats scaleF(info->scaleCenter.simd);
|
||||
zeus::simd_floats fillF(info->fillColor.simd);
|
||||
zeus::simd_floats outlineF(info->outlineColor.simd);
|
||||
zeus::simd_floats extentF(info->blockExtent.simd);
|
||||
os.format("frme_obj.retro_pane_dimensions = (%f,%f)\n"
|
||||
"frme_obj.retro_pane_scale_center = (%f,%f,%f)\n"
|
||||
"frme_obj.retro_textpane_font_path = '%s'\n"
|
||||
|
@ -572,22 +578,13 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
"frme_obj.retro_textpane_hjustification = bpy.types.Object.retro_textpane_hjustification[1]['items'][%d][0]\n"
|
||||
"frme_obj.retro_textpane_vjustification = bpy.types.Object.retro_textpane_vjustification[1]['items'][%d][0]\n",
|
||||
info->xDim, info->zDim,
|
||||
info->scaleCenter.vec[0],
|
||||
info->scaleCenter.vec[1],
|
||||
info->scaleCenter.vec[2],
|
||||
scaleF[0], scaleF[1], scaleF[2],
|
||||
fontPath.getRelativePathUTF8().data(),
|
||||
info->wordWrap ? "True" : "False",
|
||||
info->horizontal ? "True" : "False",
|
||||
info->fillColor.vec[0],
|
||||
info->fillColor.vec[1],
|
||||
info->fillColor.vec[2],
|
||||
info->fillColor.vec[3],
|
||||
info->outlineColor.vec[0],
|
||||
info->outlineColor.vec[1],
|
||||
info->outlineColor.vec[2],
|
||||
info->outlineColor.vec[3],
|
||||
info->blockExtent.vec[0],
|
||||
info->blockExtent.vec[1],
|
||||
fillF[0], fillF[1], fillF[2], fillF[3],
|
||||
outlineF[0], outlineF[1], outlineF[2], outlineF[3],
|
||||
extentF[0], extentF[1],
|
||||
jpFontPath.getRelativePathUTF8().data(),
|
||||
info->jpnPointScale[0],
|
||||
info->jpnPointScale[1],
|
||||
|
@ -652,6 +649,10 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
}
|
||||
}
|
||||
|
||||
zeus::simd_floats xfMtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
w.basis[i].simd.copy_to(xfMtxF[i]);
|
||||
zeus::simd_floats originF(w.origin.simd);
|
||||
os.format("mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
"frme_obj.rotation_mode = 'QUATERNION'\n"
|
||||
|
@ -659,9 +660,9 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
|||
"frme_obj.rotation_quaternion = mtxd[1] * angle\n"
|
||||
"frme_obj.scale = mtxd[2]\n"
|
||||
"bpy.context.scene.objects.link(frme_obj)\n",
|
||||
w.basis[0].vec[0], w.basis[0].vec[1], w.basis[0].vec[2], w.origin.vec[0],
|
||||
w.basis[1].vec[0], w.basis[1].vec[1], w.basis[1].vec[2], w.origin.vec[1],
|
||||
w.basis[2].vec[0], w.basis[2].vec[1], w.basis[2].vec[2], w.origin.vec[2]);
|
||||
xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], originF[0],
|
||||
xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], originF[1],
|
||||
xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], originF[2]);
|
||||
}
|
||||
|
||||
os.centerView();
|
||||
|
|
|
@ -463,9 +463,9 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
|
|||
}
|
||||
else
|
||||
{
|
||||
head.localToWorldMtx[0].vec[0] = 1.f;
|
||||
head.localToWorldMtx[1].vec[1] = 1.f;
|
||||
head.localToWorldMtx[2].vec[2] = 1.f;
|
||||
head.localToWorldMtx[0].simd[0] = 1.f;
|
||||
head.localToWorldMtx[1].simd[1] = 1.f;
|
||||
head.localToWorldMtx[2].simd[2] = 1.f;
|
||||
}
|
||||
head.meshCount = meshes.size();
|
||||
head.geomSecIdx = 0;
|
||||
|
|
|
@ -64,8 +64,10 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
entryName.data());
|
||||
|
||||
for (const Node& n : nodes)
|
||||
os.format("bm.verts.new((%f,%f,%f))\n",
|
||||
n.position.vec[0], n.position.vec[1], n.position.vec[2]);
|
||||
{
|
||||
zeus::simd_floats f(n.position.simd);
|
||||
os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
os << "bm.verts.ensure_lookup_table()\n";
|
||||
|
||||
|
@ -128,15 +130,18 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
if (xf)
|
||||
{
|
||||
const zeus::CMatrix4f& w = *xf;
|
||||
zeus::simd_floats xfMtxF[4];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
w.m[i].mSimd.copy_to(xfMtxF[i]);
|
||||
os.format("mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
"path_mesh_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"path_mesh_obj.location = mtxd[0]\n"
|
||||
"path_mesh_obj.rotation_quaternion = mtxd[1]\n"
|
||||
"path_mesh_obj.scale = mtxd[2]\n",
|
||||
w.m[0][0], w.m[1][0], w.m[2][0], w.m[3][0],
|
||||
w.m[0][1], w.m[1][1], w.m[2][1], w.m[3][1],
|
||||
w.m[0][2], w.m[1][2], w.m[2][2], w.m[3][2]);
|
||||
xfMtxF[0][0], xfMtxF[1][0], xfMtxF[2][0], xfMtxF[3][0],
|
||||
xfMtxF[0][1], xfMtxF[1][1], xfMtxF[2][1], xfMtxF[3][1],
|
||||
xfMtxF[0][2], xfMtxF[1][2], xfMtxF[2][2], xfMtxF[3][2]);
|
||||
}
|
||||
|
||||
os.linkBackground("//!area.blend");
|
||||
|
|
|
@ -27,7 +27,7 @@ zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const
|
|||
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
||||
}
|
||||
|
||||
if (aabbOut.min.x > aabbOut.max.x)
|
||||
if (aabbOut.min.x() > aabbOut.max.x())
|
||||
return {};
|
||||
|
||||
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
|
||||
|
|
|
@ -19,7 +19,7 @@ zeus::CAABox DoorArea::getVISIAABB(hecl::blender::Token& btok) const
|
|||
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
||||
}
|
||||
|
||||
if (aabbOut.min.x > aabbOut.max.x)
|
||||
if (aabbOut.min.x() > aabbOut.max.x())
|
||||
return {};
|
||||
|
||||
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
|
||||
|
|
|
@ -269,9 +269,10 @@ zeus::CTransform ConvertEditorEulerToTransform4f(const zeus::CVector3f& scale,
|
|||
const zeus::CVector3f& orientation,
|
||||
const zeus::CVector3f& position)
|
||||
{
|
||||
return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) *
|
||||
zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) *
|
||||
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) *
|
||||
zeus::simd_floats f(orientation.mSimd);
|
||||
return zeus::CTransform::RotateZ(zeus::degToRad(f[2])) *
|
||||
zeus::CTransform::RotateY(zeus::degToRad(f[1])) *
|
||||
zeus::CTransform::RotateX(zeus::degToRad(f[0])) *
|
||||
zeus::CTransform::Scale(scale) +
|
||||
position;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ zeus::CAABox Platform::getVISIAABB(hecl::blender::Token& btok) const
|
|||
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
||||
}
|
||||
|
||||
if (aabbOut.min.x > aabbOut.max.x)
|
||||
if (aabbOut.min.x() > aabbOut.max.x())
|
||||
return {};
|
||||
|
||||
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
|
||||
|
|
|
@ -60,7 +60,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
|||
{
|
||||
size_t idx = 0;
|
||||
for (const DNAANIM::Value& val : rotKeys)
|
||||
fixedRotKeys[idx++][c] = val.v4.vec[c];
|
||||
fixedRotKeys[idx++][c] = val.simd[c];
|
||||
}
|
||||
|
||||
for (zeus::CQuaternion& rot : fixedRotKeys)
|
||||
|
@ -85,7 +85,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
|||
{
|
||||
size_t idx = 0;
|
||||
for (const DNAANIM::Value& val : transKeys)
|
||||
fixedTransKeys[idx++][c] = val.v3.vec[c];
|
||||
fixedTransKeys[idx++][c] = val.simd[c];
|
||||
}
|
||||
|
||||
for (zeus::CVector3f& t : fixedTransKeys)
|
||||
|
@ -108,7 +108,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
|||
auto frameit = frames.begin();
|
||||
ao.changeCurve(ANIMOutStream::CurveType::Scale, c, scaleKeys.size());
|
||||
for (const DNAANIM::Value& val : scaleKeys)
|
||||
ao.write(*frameit++, val.v3.vec[c]);
|
||||
ao.write(*frameit++, val.simd[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec3fBig((*kit++).v3);
|
||||
writer.writeVec3fBig(atVec3f{(*kit++).simd});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec4fBig((*kit++).v4);
|
||||
writer.writeVec4fBig(atVec4f{(*kit++).simd});
|
||||
}
|
||||
if (std::get<1>(bone.second))
|
||||
++cit;
|
||||
|
@ -399,7 +399,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec3fBig((*kit++).v3);
|
||||
writer.writeVec3fBig(atVec3f{(*kit++).simd});
|
||||
}
|
||||
if (std::get<2>(bone.second))
|
||||
++cit;
|
||||
|
|
|
@ -64,15 +64,19 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& c
|
|||
cinfId.toUint32());
|
||||
|
||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
||||
{
|
||||
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
||||
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
||||
os.format("bone = arm.edit_bones.new('%s')\n"
|
||||
"bone.head = (%f,%f,%f)\n"
|
||||
"bone.tail = (%f,%f,%f)\n"
|
||||
"bone.use_inherit_scale = False\n"
|
||||
"arm_bone_table[%u] = bone\n",
|
||||
getBoneNameFromId(bone.m_origBone.id)->c_str(),
|
||||
bone.m_origBone.origin.vec[0], bone.m_origBone.origin.vec[1], bone.m_origBone.origin.vec[2],
|
||||
bone.m_tail[0], bone.m_tail[1], bone.m_tail[2],
|
||||
originF[0], originF[1], originF[2],
|
||||
tailF[0], tailF[1], tailF[2],
|
||||
bone.m_origBone.id);
|
||||
}
|
||||
|
||||
for (const Bone& bone : bones)
|
||||
if (bone.parentId != 97)
|
||||
|
|
|
@ -193,7 +193,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
|||
}
|
||||
}
|
||||
|
||||
static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f};
|
||||
static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}};
|
||||
|
||||
void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID32, zeus::CMatrix4f>& addTo,
|
||||
|
|
|
@ -73,7 +73,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os,
|
|||
{
|
||||
size_t idx = 0;
|
||||
for (const DNAANIM::Value& val : rotKeys)
|
||||
fixedRotKeys[idx++][c] = val.v4.vec[c];
|
||||
fixedRotKeys[idx++][c] = val.simd[c];
|
||||
}
|
||||
|
||||
for (zeus::CQuaternion& rot : fixedRotKeys)
|
||||
|
@ -98,7 +98,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os,
|
|||
{
|
||||
size_t idx = 0;
|
||||
for (const DNAANIM::Value& val : transKeys)
|
||||
fixedTransKeys[idx++][c] = val.v3.vec[c];
|
||||
fixedTransKeys[idx++][c] = val.simd[c];
|
||||
}
|
||||
|
||||
for (zeus::CVector3f& t : fixedTransKeys)
|
||||
|
@ -121,7 +121,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os,
|
|||
auto frameit = frames.begin();
|
||||
ao.changeCurve(ANIMOutStream::CurveType::Scale, c, scaleKeys.size());
|
||||
for (const DNAANIM::Value& val : scaleKeys)
|
||||
ao.write(*frameit++, val.v3.vec[c]);
|
||||
ao.write(*frameit++, val.simd[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec3fBig((*kit++).v3);
|
||||
writer.writeVec3fBig(atVec3f{(*kit++).simd});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec4fBig((*kit++).v4);
|
||||
writer.writeVec4fBig(atVec4f{(*kit++).simd});
|
||||
}
|
||||
if (std::get<1>(bone.second))
|
||||
++cit;
|
||||
|
@ -415,7 +415,7 @@ void ANIM::ANIM0::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
const std::vector<DNAANIM::Value>& keys = *cit++;
|
||||
auto kit = keys.begin();
|
||||
for (size_t k=0 ; k<head.keyCount ; ++k)
|
||||
writer.writeVec3fBig((*kit++).v3);
|
||||
writer.writeVec3fBig(atVec3f{(*kit++).simd});
|
||||
}
|
||||
if (std::get<2>(bone.second))
|
||||
++cit;
|
||||
|
|
|
@ -17,15 +17,19 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID64& c
|
|||
cinfId.toUint64());
|
||||
|
||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
||||
{
|
||||
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
||||
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
||||
os.format("bone = arm.edit_bones.new('%s')\n"
|
||||
"bone.head = (%f,%f,%f)\n"
|
||||
"bone.tail = (%f,%f,%f)\n"
|
||||
"bone.use_inherit_scale = False\n"
|
||||
"arm_bone_table[%u] = bone\n",
|
||||
getBoneNameFromId(bone.m_origBone.id)->c_str(),
|
||||
bone.m_origBone.origin.vec[0], bone.m_origBone.origin.vec[1], bone.m_origBone.origin.vec[2],
|
||||
bone.m_tail[0], bone.m_tail[1], bone.m_tail[2],
|
||||
originF[0], originF[1], originF[2],
|
||||
tailF[0], tailF[1], tailF[2],
|
||||
bone.m_origBone.id);
|
||||
}
|
||||
|
||||
if (bones.size())
|
||||
{
|
||||
|
|
|
@ -203,7 +203,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
|||
}
|
||||
}
|
||||
|
||||
static const atVec4f BottomRow = {0.f, 0.f, 0.f, 1.f};
|
||||
static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}};
|
||||
|
||||
void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID64, zeus::CMatrix4f>& addTo,
|
||||
|
|
|
@ -127,7 +127,7 @@ void SplashScreen::updateContentOpacity(float opacity)
|
|||
zeus::CColor color = zeus::CColor::lerp(clearColor, res.themeData().uiText(), opacity);
|
||||
m_title->colorGlyphs(color);
|
||||
m_buildInfo->colorGlyphs(color);
|
||||
m_badgeIcon->setMultiplyColor({1.f, 1.f, 1.f, color.a});
|
||||
m_badgeIcon->setMultiplyColor({1.f, 1.f, 1.f, color.a()});
|
||||
m_badgeText->colorGlyphs(color);
|
||||
m_newButt.m_view->colorGlyphs(color);
|
||||
m_openButt.m_view->colorGlyphs(color);
|
||||
|
|
|
@ -87,20 +87,20 @@ void ViewManager::TestGameView::think()
|
|||
if (g_StateManager->Player() && playerInfo && playerInfo->toBoolean())
|
||||
{
|
||||
const CPlayer& pl = g_StateManager->GetPlayer();
|
||||
zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
|
||||
zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
|
||||
zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
|
||||
const zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
|
||||
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
|
||||
const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
|
||||
overlayText += hecl::Format("Player Position: x %f, y %f, z %f\n"
|
||||
" Quaternion: w %f, x %f, y %f, z %f\n"
|
||||
" Roll: %f, Pitch: %f, Yaw: %f\n"
|
||||
"Camera Position: x %f, y %f, z %f\n"
|
||||
" Quaternion: w %f, x %f, y %f, z %f\n"
|
||||
" Roll: %f, Pitch: %f, Yaw: %f\n",
|
||||
pl.GetTranslation().x, pl.GetTranslation().y, pl.GetTranslation().z,
|
||||
plQ.w, plQ.x, plQ.y, plQ.z,
|
||||
pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(),
|
||||
plQ.w(), plQ.x(), plQ.y(), plQ.z(),
|
||||
plQ.roll(), plQ.pitch(), plQ.yaw(),
|
||||
camXf.origin.x, camXf.origin.y, camXf.origin.z,
|
||||
camQ.w, camQ.x, camQ.y, camQ.z,
|
||||
camXf.origin.x(), camXf.origin.y(), camXf.origin.z(),
|
||||
camQ.w(), camQ.x(), camQ.y(), camQ.z(),
|
||||
camQ.roll(), camQ.pitch(), camQ.yaw());
|
||||
}
|
||||
if (worldInfo && worldInfo->toBoolean())
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
#elif _WIN32
|
||||
#include <../ucrt/malloc.h>
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Winclude-next-absolute-path"
|
||||
#include_next <malloc.h>
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // URDE_NESEMULATOR_MALLOC_H
|
||||
|
|
|
@ -130,8 +130,10 @@ void CSfxManager::CSfxEmitterWrapper::Play()
|
|||
else
|
||||
x1a_reverb = 0.f;
|
||||
|
||||
zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
x50_emitterHandle = CAudioSys::GetAmuseEngine().addEmitter(
|
||||
x24_parmData.x0_pos.v, x24_parmData.xc_dir.v,
|
||||
pos.data(), dir.data(),
|
||||
x24_parmData.x18_maxDist, x24_parmData.x1c_distComp,
|
||||
x24_parmData.x24_sfxId, x24_parmData.x27_minVol,
|
||||
x24_parmData.x26_maxVol, (x24_parmData.x20_flags & 0x8) != 0);
|
||||
|
@ -180,7 +182,9 @@ void CSfxManager::CSfxEmitterWrapper::UpdateEmitterSilent()
|
|||
{
|
||||
if (x50_emitterHandle)
|
||||
{
|
||||
x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v);
|
||||
zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
x50_emitterHandle->setVectors(pos.data(), dir.data());
|
||||
x50_emitterHandle->setMaxVol(1.f / 127.f);
|
||||
}
|
||||
x55_cachedMaxVol = x24_parmData.x26_maxVol;
|
||||
|
@ -190,7 +194,9 @@ void CSfxManager::CSfxEmitterWrapper::UpdateEmitter()
|
|||
{
|
||||
if (x50_emitterHandle)
|
||||
{
|
||||
x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v);
|
||||
zeus::simd_floats pos(x24_parmData.x0_pos.mSimd);
|
||||
zeus::simd_floats dir(x24_parmData.xc_dir.mSimd);
|
||||
x50_emitterHandle->setVectors(pos.data(), dir.data());
|
||||
x50_emitterHandle->setMaxVol(x55_cachedMaxVol);
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +286,11 @@ void CSfxManager::AddListener(ESfxChannels channel,
|
|||
{
|
||||
if (m_listener)
|
||||
CAudioSys::GetAmuseEngine().removeListener(m_listener.get());
|
||||
m_listener = CAudioSys::GetAmuseEngine().addListener(pos.v, dir.v, heading.v, up.v, frontRadius,
|
||||
zeus::simd_floats p(pos.mSimd);
|
||||
zeus::simd_floats d(dir.mSimd);
|
||||
zeus::simd_floats h(heading.mSimd);
|
||||
zeus::simd_floats u(up.mSimd);
|
||||
m_listener = CAudioSys::GetAmuseEngine().addListener(p.data(), d.data(), h.data(), u.data(), frontRadius,
|
||||
surroundRadius, soundSpeed, vol);
|
||||
}
|
||||
|
||||
|
@ -290,7 +300,11 @@ void CSfxManager::UpdateListener(const zeus::CVector3f& pos, const zeus::CVector
|
|||
{
|
||||
if (m_listener)
|
||||
{
|
||||
m_listener->setVectors(pos.v, dir.v, heading.v, up.v);
|
||||
zeus::simd_floats p(pos.mSimd);
|
||||
zeus::simd_floats d(dir.mSimd);
|
||||
zeus::simd_floats h(heading.mSimd);
|
||||
zeus::simd_floats u(up.mSimd);
|
||||
m_listener->setVectors(p.data(), d.data(), h.data(), u.data());
|
||||
m_listener->setVolume(vol);
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +456,9 @@ void CSfxManager::UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f&
|
|||
emitter.GetEmitterData().xc_dir = dir;
|
||||
emitter.GetEmitterData().x26_maxVol = maxVol;
|
||||
amuse::Emitter& h = *emitter.GetHandle();
|
||||
h.setVectors(pos.v, dir.v);
|
||||
zeus::simd_floats p(pos.mSimd);
|
||||
zeus::simd_floats d(dir.mSimd);
|
||||
h.setVectors(p.data(), d.data());
|
||||
h.setMaxVol(maxVol);
|
||||
}
|
||||
|
||||
|
|
|
@ -623,8 +623,8 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa
|
|||
float deltaFrames = input.DeltaTime() * 60.f;
|
||||
SetShouldRotatingSoundBePlaying(true);
|
||||
zeus::CEulerAngles eulers(xa8_renderStates[0].x8_camOrientation);
|
||||
zeus::CRelAngle angX(eulers.x);
|
||||
zeus::CRelAngle angZ(eulers.z);
|
||||
zeus::CRelAngle angX(eulers.x());
|
||||
zeus::CRelAngle angZ(eulers.z());
|
||||
|
||||
float dt = deltaFrames * g_tweakAutoMapper->GetCamRotateDegreesPerFrame();
|
||||
|
||||
|
@ -892,7 +892,7 @@ zeus::CQuaternion CAutoMapper::GetMiniMapCameraOrientation(const CStateManager&
|
|||
{
|
||||
const CGameCamera* cam = stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr);
|
||||
zeus::CEulerAngles camAngles(zeus::CQuaternion(cam->GetTransform().buildMatrix3f()));
|
||||
float rotMod = -(std::floor(camAngles.z * 0.15915494f) * 2.f * M_PIF - camAngles.z);
|
||||
float rotMod = -(std::floor(camAngles.z() / (2.f * M_PIF)) * 2.f * M_PIF - camAngles.z());
|
||||
if (rotMod < 0.f)
|
||||
rotMod += 2.f * M_PIF;
|
||||
|
||||
|
@ -1035,9 +1035,9 @@ float CAutoMapper::GetDesiredMiniMapCameraDistance(const CStateManager& mgr) con
|
|||
|
||||
zeus::CVector3f xfPoint = mapa->GetAreaPostTransform(*x24_world, xa0_curAreaId) * mapa->GetAreaCenterPoint();
|
||||
zeus::CVector3f maxMargin;
|
||||
maxMargin.x = std::max(xfPoint.x - aabb.min.x, aabb.max.x - xfPoint.x);
|
||||
maxMargin.y = std::max(xfPoint.y - aabb.min.y, aabb.max.y - xfPoint.y);
|
||||
maxMargin.z = std::max(xfPoint.z - aabb.min.z, aabb.max.z - xfPoint.z);
|
||||
maxMargin.x() = std::max(xfPoint.x() - aabb.min.x(), aabb.max.x() - xfPoint.x());
|
||||
maxMargin.y() = std::max(xfPoint.y() - aabb.min.y(), aabb.max.y() - xfPoint.y());
|
||||
maxMargin.z() = std::max(xfPoint.z() - aabb.min.z(), aabb.max.z() - xfPoint.z());
|
||||
zeus::CVector3f extent = mapa->GetBoundingBox().max - mapa->GetBoundingBox().min;
|
||||
|
||||
return (0.5f * (0.5f * extent.magnitude()) + 0.5f * maxMargin.magnitude()) *
|
||||
|
@ -1589,7 +1589,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
|||
float func = zeus::clamp(0.f, 0.5f * (1.f + std::sin(5.f * CGraphics::GetSecondsMod900() - (M_PIF / 2.f))), 1.f);
|
||||
float scale = std::min(0.6f * g_tweakAutoMapper->GetMaxCamDist() / g_tweakAutoMapper->GetMinCamDist(), objectScale);
|
||||
zeus::CEulerAngles eulers(mgr.GetCameraManager()->GetCurrentCameraTransform(mgr));
|
||||
zeus::CRelAngle angle(eulers.z);
|
||||
zeus::CRelAngle angle(eulers.z());
|
||||
zeus::CTransform playerXf(zeus::CMatrix3f::RotateZ(angle),
|
||||
CMapArea::GetAreaPostTranslate(*x24_world, mgr.GetNextAreaId()) + mgr.GetPlayer().GetTranslation());
|
||||
CGraphics::SetModelMatrix(mapXf * playerXf * zeus::CTransform::Scale(scale * (0.25f * func + 0.75f)));
|
||||
|
@ -1600,7 +1600,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
|||
alpha = xa8_renderStates[0].x34_alphaSurfaceVisited;
|
||||
alpha *= mapAlpha;
|
||||
zeus::CColor modColor = g_tweakAutoMapper->GetMiniMapSamusModColor();
|
||||
modColor.a *= alpha;
|
||||
modColor.a() *= alpha;
|
||||
CModelFlags flags(5, 0, 8 | 1, modColor); /* Depth GEqual */
|
||||
flags.m_extendedShader = EExtendedShader::DepthGEqualNoZWrite;
|
||||
x30_miniMapSamus->Draw(flags);
|
||||
|
@ -1651,7 +1651,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
|||
alpha *= xa8_renderStates[0].x34_alphaSurfaceVisited;
|
||||
alpha *= mapAlpha;
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = alpha;
|
||||
color.a() = alpha;
|
||||
filter.drawVerts(color, verts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -294,10 +294,10 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C
|
|||
|
||||
Instance& instance = const_cast<Instance&>(m_instances[instIdx]);
|
||||
|
||||
if (surfColor.a)
|
||||
if (surfColor.a())
|
||||
instance.m_surfacePrims.draw(surfColor, m_primStart, m_primCount);
|
||||
|
||||
if (lineColor.a)
|
||||
if (lineColor.a())
|
||||
{
|
||||
bool draw2 = lineWidth > 1.f;
|
||||
athena::io::MemoryReader r(x1c_outlineOffset, INT_MAX);
|
||||
|
@ -306,7 +306,7 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C
|
|||
std::vector<CLineRenderer>& linePrims = instance.m_linePrims;
|
||||
zeus::CColor color = lineColor;
|
||||
if (draw2)
|
||||
color.a *= 0.5f;
|
||||
color.a() *= 0.5f;
|
||||
float width = lineWidth;
|
||||
|
||||
auto primIt = linePrims.begin();
|
||||
|
|
|
@ -66,16 +66,16 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3
|
|||
if (w == parms.GetFocusWorldIndex())
|
||||
{
|
||||
surfColor = data.GetSurfaceColorSelected();
|
||||
surfColor.a *= parms.GetAlpha();
|
||||
surfColor.a() *= parms.GetAlpha();
|
||||
outlineColor = data.GetOutlineColorSelected();
|
||||
outlineColor.a *= parms.GetAlpha();
|
||||
outlineColor.a() *= parms.GetAlpha();
|
||||
}
|
||||
else
|
||||
{
|
||||
surfColor = data.GetSurfaceColorUnselected();
|
||||
surfColor.a *= parms.GetAlpha();
|
||||
surfColor.a() *= parms.GetAlpha();
|
||||
outlineColor = data.GetSurfaceColorUnselected();
|
||||
outlineColor.a *= parms.GetAlpha();
|
||||
outlineColor.a() *= parms.GetAlpha();
|
||||
}
|
||||
|
||||
for (int h=0 ; h<data.GetNumMapAreaDatas() ; ++h)
|
||||
|
@ -85,7 +85,7 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3
|
|||
{
|
||||
const CMapArea::CMapAreaSurface& surf = x4_hexagonToken->GetSurface(s);
|
||||
zeus::CVector3f centerPos = hexXf * surf.GetCenterPosition();
|
||||
sortInfos.emplace_back(centerPos.y, w, h, s, surfColor, outlineColor);
|
||||
sortInfos.emplace_back(centerPos.y(), w, h, s, surfColor, outlineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,11 +109,11 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3
|
|||
surfColor = zeus::CColor::lerp(g_tweakAutoMapper->GetSurfaceSelectVisitedColor(),
|
||||
g_tweakAutoMapper->GetAreaFlashPulseColor(),
|
||||
parms.GetFlashPulse());
|
||||
surfColor.a = info.GetSurfaceColor().a;
|
||||
surfColor.a() = info.GetSurfaceColor().a();
|
||||
outlineColor = zeus::CColor::lerp(g_tweakAutoMapper->GetOutlineSelectVisitedColor(),
|
||||
g_tweakAutoMapper->GetAreaFlashPulseColor(),
|
||||
parms.GetFlashPulse());
|
||||
outlineColor.a = info.GetOutlineColor().a;
|
||||
outlineColor.a() = info.GetOutlineColor().a();
|
||||
}
|
||||
|
||||
zeus::CTransform hexXf = mwData.GetMapAreaData(info.GetAreaIndex());
|
||||
|
|
|
@ -311,9 +311,9 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
|||
else
|
||||
{
|
||||
finalSurfColor = *surfaceColor;
|
||||
finalSurfColor.a = surfDepth * alphaSurf;
|
||||
finalSurfColor.a() = surfDepth * alphaSurf;
|
||||
finalOutlineColor = *outlineColor;
|
||||
finalOutlineColor.a = outlineDepth * alphaOutline;
|
||||
finalOutlineColor.a() = outlineDepth * alphaOutline;
|
||||
}
|
||||
|
||||
if ((selArea != playerArea || parms.GetHintAreaFlashIntensity() == 0.f) &&
|
||||
|
@ -331,7 +331,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
|||
{
|
||||
const CMapArea::CMapAreaSurface& surf = mapa->GetSurface(i);
|
||||
zeus::CVector3f pos = modelView * surf.GetCenterPosition();
|
||||
sortInfos.emplace_back(pos.y, thisArea, CMapObjectSortInfo::EObjectCode::Surface, i,
|
||||
sortInfos.emplace_back(pos.y(), thisArea, CMapObjectSortInfo::EObjectCode::Surface, i,
|
||||
finalSurfColor, finalOutlineColor);
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
|||
zeus::CVector3f center = obj.BuildSurfaceCenterPoint(s);
|
||||
zeus::CVector3f pos = modelView *
|
||||
(CMapArea::GetAreaPostTranslate(parms.GetWorld(), thisArea) + center);
|
||||
sortInfos.emplace_back(pos.y, thisArea, CMapObjectSortInfo::EObjectCode::DoorSurface, si+s,
|
||||
sortInfos.emplace_back(pos.y(), thisArea, CMapObjectSortInfo::EObjectCode::DoorSurface, si+s,
|
||||
zeus::CColor{1.f, 0.f, 1.f, 1.f}, zeus::CColor{1.f, 0.f, 1.f, 1.f});
|
||||
}
|
||||
continue;
|
||||
|
@ -364,8 +364,8 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
|||
|
||||
zeus::CVector3f pos = modelView * (obj.GetTransform().origin +
|
||||
CMapArea::GetAreaPostTranslate(parms.GetWorld(), thisArea));
|
||||
sortInfos.emplace_back(pos.y, thisArea, doorType ? CMapObjectSortInfo::EObjectCode::Door :
|
||||
CMapObjectSortInfo::EObjectCode::Object,
|
||||
sortInfos.emplace_back(pos.y(), thisArea, doorType ? CMapObjectSortInfo::EObjectCode::Door :
|
||||
CMapObjectSortInfo::EObjectCode::Object,
|
||||
i, zeus::CColor{1.f, 0.f, 1.f, 1.f}, zeus::CColor{1.f, 0.f, 1.f, 1.f});
|
||||
}
|
||||
}
|
||||
|
@ -476,8 +476,8 @@ static Circle2 ExactCircle3(const zeus::CVector2f* a, const zeus::CVector2f* b,
|
|||
zeus::CVector2f magVec(d1.magSquared() * 0.5f, d2.magSquared() * 0.5f);
|
||||
if (std::fabs(cross) > 0.01f)
|
||||
{
|
||||
zeus::CVector2f tmp((d2.y * magVec.x - d1.y * magVec.y) / cross,
|
||||
(d1.x * magVec.y - d2.x * magVec.x) / cross);
|
||||
zeus::CVector2f tmp((d2.y() * magVec.x() - d1.y() * magVec.y()) / cross,
|
||||
(d1.x() * magVec.y() - d2.x() * magVec.x()) / cross);
|
||||
ret.x0_point = *a + tmp;
|
||||
ret.x8_radiusSq = tmp.magSquared();
|
||||
}
|
||||
|
@ -760,10 +760,10 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld
|
|||
zeus::CAABox aabb = mapa->GetBoundingBox().getTransformedAABox(mapa->GetAreaPostTransform(wld, i));
|
||||
for (int j=0 ; j<8 ; ++j)
|
||||
{
|
||||
zeus::CVector3f point = aabb.getPoint(j);
|
||||
coords.emplace_back(point.x, point.y);
|
||||
zMin = std::min(point.z, zMin);
|
||||
zMax = std::max(point.z, zMax);
|
||||
const zeus::CVector3f point = aabb.getPoint(j);
|
||||
coords.push_back(point.toVec2f());
|
||||
zMin = std::min(point.z(), zMin);
|
||||
zMax = std::max(point.z(), zMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -772,35 +772,35 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld
|
|||
Circle circle = MinCircle(coords);
|
||||
const_cast<CMapWorld*>(this)->x3c_worldSphereRadius = circle.x8_radius;
|
||||
const_cast<CMapWorld*>(this)->x30_worldSpherePoint =
|
||||
zeus::CVector3f(circle.x0_point.x, circle.x0_point.y, (zMin + zMax) * 0.5f);
|
||||
zeus::CVector3f(circle.x0_point.x(), circle.x0_point.y(), (zMin + zMax) * 0.5f);
|
||||
const_cast<CMapWorld*>(this)->x40_worldSphereHalfDepth = (zMax - zMin) * 0.5f;
|
||||
}
|
||||
|
||||
zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const
|
||||
{
|
||||
zeus::CVector3f ret = point;
|
||||
if (std::fabs(lookVec.z) > FLT_EPSILON)
|
||||
if (std::fabs(lookVec.z()) > FLT_EPSILON)
|
||||
{
|
||||
float f2 = point.z - (x40_worldSphereHalfDepth + x30_worldSpherePoint.z);
|
||||
float f1 = point.z - (x30_worldSpherePoint.z - x40_worldSphereHalfDepth);
|
||||
float f2 = point.z() - (x40_worldSphereHalfDepth + x30_worldSpherePoint.z());
|
||||
float f1 = point.z() - (x30_worldSpherePoint.z() - x40_worldSphereHalfDepth);
|
||||
if (f2 > 0.f)
|
||||
ret = point + lookVec * (-f2 / lookVec.z);
|
||||
ret = point + lookVec * (-f2 / lookVec.z());
|
||||
else if (f1 < 0.f)
|
||||
ret = point + lookVec * (-f1 / lookVec.z);
|
||||
ret = point + lookVec * (-f1 / lookVec.z());
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.z = zeus::clamp(x30_worldSpherePoint.z - x40_worldSphereHalfDepth, ret.z,
|
||||
x40_worldSphereHalfDepth + x30_worldSpherePoint.z);
|
||||
ret.z() = zeus::clamp(x30_worldSpherePoint.z() - x40_worldSphereHalfDepth, float(ret.z()),
|
||||
x40_worldSphereHalfDepth + x30_worldSpherePoint.z());
|
||||
}
|
||||
|
||||
zeus::CVector2f tmp(x30_worldSpherePoint.x, x30_worldSpherePoint.y);
|
||||
zeus::CVector2f vec2 = zeus::CVector2f(point.x, point.y) - tmp;
|
||||
zeus::CVector2f tmp = x30_worldSpherePoint.toVec2f();
|
||||
zeus::CVector2f vec2 = point.toVec2f() - tmp;
|
||||
if (vec2.magnitude() > x3c_worldSphereRadius)
|
||||
{
|
||||
tmp += vec2.normalized() * x3c_worldSphereRadius;
|
||||
ret.x = tmp.x;
|
||||
ret.y = tmp.y;
|
||||
ret.x() = float(tmp.x());
|
||||
ret.y() = float(tmp.y());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -31,8 +31,8 @@ CMappableObject::CMappableObject(const void* buf)
|
|||
|
||||
zeus::CTransform CMappableObject::AdjustTransformForType()
|
||||
{
|
||||
const float doorCenterX = g_tweakAutoMapper->GetDoorCenter().x;
|
||||
const float doorCenterZ = g_tweakAutoMapper->GetDoorCenter().z;
|
||||
const float doorCenterX = g_tweakAutoMapper->GetDoorCenter().x();
|
||||
const float doorCenterZ = g_tweakAutoMapper->GetDoorCenter().z();
|
||||
if (x0_type == EMappableObjectType::BigDoor1)
|
||||
{
|
||||
zeus::CTransform orientation;
|
||||
|
@ -127,11 +127,11 @@ CMappableObject::GetDoorColors(int curAreaId, const CMapWorldInfo& mwInfo, float
|
|||
color = zeus::CColor::skClear;
|
||||
}
|
||||
|
||||
color.a *= alpha;
|
||||
return {color, zeus::CColor(std::min(1.4f * color.r, 1.f),
|
||||
std::min(1.4f * color.g, 1.f),
|
||||
std::min(1.4f * color.b, 1.f),
|
||||
std::min(1.4f * color.a, 1.f))};
|
||||
color.a() *= alpha;
|
||||
return {color, zeus::CColor(std::min(1.4f * color.r(), 1.f),
|
||||
std::min(1.4f * color.g(), 1.f),
|
||||
std::min(1.4f * color.b(), 1.f),
|
||||
std::min(1.4f * color.a(), 1.f))};
|
||||
}
|
||||
|
||||
void CMappableObject::PostConstruct(const void *)
|
||||
|
@ -200,7 +200,7 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo,
|
|||
break;
|
||||
}
|
||||
|
||||
iconColor.a *= alpha;
|
||||
iconColor.a() *= alpha;
|
||||
|
||||
TLockedToken<CTexture> tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), iconRes});
|
||||
if (!m_texQuadFilter || m_texQuadFilter->GetTex().GetObj() != tex.GetObj())
|
||||
|
@ -243,15 +243,15 @@ zeus::CVector3f CMappableObject::BuildSurfaceCenterPoint(int surfIdx) const
|
|||
case 0:
|
||||
return x10_transform * zeus::CVector3f::skZero;
|
||||
case 1:
|
||||
return x10_transform * zeus::CVector3f{0.f, 0.f, 2.f * doorCenter.x};
|
||||
return x10_transform * zeus::CVector3f{0.f, 0.f, 2.f * doorCenter.x()};
|
||||
case 2:
|
||||
return x10_transform * zeus::CVector3f{0.f, -doorCenter.y, 0.f};
|
||||
return x10_transform * zeus::CVector3f{0.f, -doorCenter.y(), 0.f};
|
||||
case 3:
|
||||
return x10_transform * zeus::CVector3f{0.f, doorCenter.y, 0.f};
|
||||
return x10_transform * zeus::CVector3f{0.f, doorCenter.y(), 0.f};
|
||||
case 4:
|
||||
return x10_transform * zeus::CVector3f{-doorCenter.x, 0.f, 0.f};
|
||||
return x10_transform * zeus::CVector3f{-doorCenter.x(), 0.f, 0.f};
|
||||
case 5:
|
||||
return x10_transform * zeus::CVector3f{doorCenter.x, 0.f, 0.f};
|
||||
return x10_transform * zeus::CVector3f{doorCenter.x(), 0.f, 0.f};
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@ -284,16 +284,17 @@ boo::ObjToken<boo::IGraphicsBufferS> CMappableObject::g_doorIbo;
|
|||
void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks)
|
||||
{
|
||||
const zeus::CVector3f& center = tweaks.GetDoorCenter();
|
||||
zeus::simd_floats centerF(center.mSimd);
|
||||
zeus::CVector3f* doorVerts = const_cast<zeus::CVector3f*>(&CMappableObject::skDoorVerts[0]);
|
||||
/* Wrap door verts around -Z to build surface */
|
||||
doorVerts[0].assign( -center.z, -center.y, 0.f);
|
||||
doorVerts[1].assign( -center.z, -center.y, 2.f * center.x);
|
||||
doorVerts[2].assign( -center.z, center.y, 0.f);
|
||||
doorVerts[3].assign( -center.z, center.y, 2.f * center.x);
|
||||
doorVerts[4].assign(.2f * -center.z, -center.y, 0.f);
|
||||
doorVerts[5].assign(.2f * -center.z, -center.y, 2.f * center.x);
|
||||
doorVerts[6].assign(.2f * -center.z, center.y, 0.f);
|
||||
doorVerts[7].assign(.2f * -center.z, center.y, 2.f * center.x);
|
||||
doorVerts[0].assign( -centerF[2], -centerF[1], 0.f);
|
||||
doorVerts[1].assign( -centerF[2], -centerF[1], 2.f * centerF[0]);
|
||||
doorVerts[2].assign( -centerF[2], centerF[1], 0.f);
|
||||
doorVerts[3].assign( -centerF[2], centerF[1], 2.f * centerF[0]);
|
||||
doorVerts[4].assign(.2f * -centerF[2], -centerF[1], 0.f);
|
||||
doorVerts[5].assign(.2f * -centerF[2], -centerF[1], 2.f * centerF[0]);
|
||||
doorVerts[6].assign(.2f * -centerF[2], centerF[1], 0.f);
|
||||
doorVerts[7].assign(.2f * -centerF[2], centerF[1], 2.f * centerF[0]);
|
||||
|
||||
CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
|
|
|
@ -162,22 +162,22 @@ s16 CSortedListManager::FindInListLower(ESortedList list, float val) const
|
|||
|
||||
s16 CSortedListManager::ConstructIntersectionArray(const zeus::CAABox& aabb)
|
||||
{
|
||||
int minXa = FindInListLower(ESortedList::MinX, aabb.min.x);
|
||||
int maxXa = FindInListUpper(ESortedList::MinX, aabb.max.x);
|
||||
int minXb = FindInListLower(ESortedList::MaxX, aabb.min.x);
|
||||
int maxXb = FindInListUpper(ESortedList::MaxX, aabb.max.x);
|
||||
int minXa = FindInListLower(ESortedList::MinX, aabb.min.x());
|
||||
int maxXa = FindInListUpper(ESortedList::MinX, aabb.max.x());
|
||||
int minXb = FindInListLower(ESortedList::MaxX, aabb.min.x());
|
||||
int maxXb = FindInListUpper(ESortedList::MaxX, aabb.max.x());
|
||||
int xEnd = std::min(int(xb000_sortedLists[3].x800_size) - maxXb, minXa) + (maxXb + (maxXa - minXa) - minXb) / 2;
|
||||
|
||||
int minYa = FindInListLower(ESortedList::MinY, aabb.min.y);
|
||||
int maxYa = FindInListUpper(ESortedList::MinY, aabb.max.y);
|
||||
int minYb = FindInListLower(ESortedList::MaxY, aabb.min.y);
|
||||
int maxYb = FindInListUpper(ESortedList::MaxY, aabb.max.y);
|
||||
int minYa = FindInListLower(ESortedList::MinY, aabb.min.y());
|
||||
int maxYa = FindInListUpper(ESortedList::MinY, aabb.max.y());
|
||||
int minYb = FindInListLower(ESortedList::MaxY, aabb.min.y());
|
||||
int maxYb = FindInListUpper(ESortedList::MaxY, aabb.max.y());
|
||||
int yEnd = std::min(int(xb000_sortedLists[4].x800_size) - maxYb, minYa) + (maxYb + (maxYa - minYa) - minYb) / 2;
|
||||
|
||||
int minZa = FindInListLower(ESortedList::MinZ, aabb.min.z);
|
||||
int maxZa = FindInListUpper(ESortedList::MinZ, aabb.max.z);
|
||||
int minZb = FindInListLower(ESortedList::MaxZ, aabb.min.z);
|
||||
int maxZb = FindInListUpper(ESortedList::MaxZ, aabb.max.z);
|
||||
int minZa = FindInListLower(ESortedList::MinZ, aabb.min.z());
|
||||
int maxZa = FindInListUpper(ESortedList::MinZ, aabb.max.z());
|
||||
int minZb = FindInListLower(ESortedList::MaxZ, aabb.min.z());
|
||||
int maxZb = FindInListUpper(ESortedList::MaxZ, aabb.max.z());
|
||||
int zEnd = std::min(int(xb000_sortedLists[5].x800_size) - maxZb, minZa) + (maxZb + (maxZa - minZa) - minZb) / 2;
|
||||
|
||||
if (xEnd < yEnd && xEnd < zEnd)
|
||||
|
@ -252,10 +252,10 @@ void CSortedListManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& o
|
|||
{
|
||||
if (mag == 0.f)
|
||||
mag = 8000.f;
|
||||
zeus::CVector3f ray = dir * mag;
|
||||
zeus::CVector3f sum = ray + pos;
|
||||
zeus::CVector3f maxs(std::max(pos.x, sum.x), std::max(pos.y, sum.y), std::max(pos.z, sum.z));
|
||||
zeus::CVector3f mins(std::min(sum.x, pos.x), std::min(sum.y, pos.y), std::min(sum.z, pos.z));
|
||||
const zeus::CVector3f ray = dir * mag;
|
||||
const zeus::CVector3f sum = ray + pos;
|
||||
zeus::CVector3f maxs(std::max(pos.x(), sum.x()), std::max(pos.y(), sum.y()), std::max(pos.z(), sum.z()));
|
||||
zeus::CVector3f mins(std::min(sum.x(), pos.x()), std::min(sum.y(), pos.y()), std::min(sum.z(), pos.z()));
|
||||
BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ void CStateManager::UpdateThermalVisor()
|
|||
{
|
||||
CGameArea* area = x850_world->GetArea(x8cc_nextAreaId);
|
||||
const zeus::CTransform& playerXf = x84c_player->GetTransform();
|
||||
zeus::CVector3f playerXYPos(playerXf.origin.x, playerXf.origin.y, 0.f);
|
||||
zeus::CVector3f playerXYPos(playerXf.origin.x(), playerXf.origin.y(), 0.f);
|
||||
CGameArea* lastArea = nullptr;
|
||||
float closestDist = FLT_MAX;
|
||||
for (const CGameArea::Dock& dock : area->GetDocks())
|
||||
|
@ -262,7 +262,7 @@ void CStateManager::UpdateThermalVisor()
|
|||
zeus::CVector3f dockCenter = (dock.GetPlaneVertices()[0] + dock.GetPlaneVertices()[1] +
|
||||
dock.GetPlaneVertices()[2] + dock.GetPlaneVertices()[3]) *
|
||||
0.25f;
|
||||
dockCenter.z = 0.f;
|
||||
dockCenter.z() = 0.f;
|
||||
float dist = (playerXYPos - dockCenter).magSquared();
|
||||
if (dist < closestDist)
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ void CStateManager::DrawReflection(const zeus::CVector3f& reflectPoint)
|
|||
zeus::CAABox aabb = x84c_player->GetBoundingBox();
|
||||
zeus::CVector3f playerPos = aabb.center();
|
||||
zeus::CVector3f surfToPlayer = playerPos - reflectPoint;
|
||||
surfToPlayer.z = 0.f;
|
||||
surfToPlayer.z() = 0.f;
|
||||
zeus::CVector3f viewPos = playerPos - surfToPlayer.normalized() * 3.5f;
|
||||
zeus::CTransform look = zeus::lookAt(viewPos, playerPos, {0.f, 0.f, -1.f});
|
||||
|
||||
|
@ -594,7 +594,7 @@ void CStateManager::DrawE3DeathEffect() const
|
|||
}
|
||||
float whiteAmt = zeus::clamp(0.f, 1.f - player.x9f4_deathTime / (0.05f * 6.f), 1.f);
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = whiteAmt;
|
||||
color.a() = whiteAmt;
|
||||
const_cast<CColoredQuadFilter&>(m_deathWhiteout).draw(color);
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ void CStateManager::DrawAdditionalFilters() const
|
|||
!x870_cameraManager->IsInCinematicCamera())
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = 1.f - xf0c_escapeTimer;
|
||||
color.a() = 1.f - xf0c_escapeTimer;
|
||||
const_cast<CColoredQuadFilter&>(m_escapeWhiteout).draw(color);
|
||||
}
|
||||
}
|
||||
|
@ -615,14 +615,14 @@ zeus::CFrustum CStateManager::SetupDrawFrustum(const SViewport& vp) const
|
|||
zeus::CFrustum ret;
|
||||
const CGameCamera* cam = x870_cameraManager->GetCurrentCamera(*this);
|
||||
zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this);
|
||||
int vpWidth = xf2c_viewportScale.x * vp.x8_width;
|
||||
int vpHeight = xf2c_viewportScale.y * vp.xc_height;
|
||||
int vpWidth = xf2c_viewportScale.x() * vp.x8_width;
|
||||
int vpHeight = xf2c_viewportScale.y() * vp.xc_height;
|
||||
int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left;
|
||||
int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top;
|
||||
g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight);
|
||||
float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y) * 2.f;
|
||||
float width = xf2c_viewportScale.x * vp.x8_width;
|
||||
float height = xf2c_viewportScale.y * vp.xc_height;
|
||||
float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y()) * 2.f;
|
||||
float width = xf2c_viewportScale.x() * vp.x8_width;
|
||||
float height = xf2c_viewportScale.y() * vp.xc_height;
|
||||
zeus::CProjection proj;
|
||||
proj.setPersp(zeus::SProjPersp{fov, width / height, cam->GetNearClipDistance(), cam->GetFarClipDistance()});
|
||||
ret.updatePlanes(camXf, proj);
|
||||
|
@ -635,15 +635,15 @@ zeus::CFrustum CStateManager::SetupViewForDraw(const SViewport& vp) const
|
|||
zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this);
|
||||
g_Renderer->SetWorldViewpoint(camXf);
|
||||
CBooModel::SetNewPlayerPositionAndTime(x84c_player->GetTranslation());
|
||||
int vpWidth = xf2c_viewportScale.x * vp.x8_width;
|
||||
int vpHeight = xf2c_viewportScale.y * vp.xc_height;
|
||||
int vpWidth = xf2c_viewportScale.x() * vp.x8_width;
|
||||
int vpHeight = xf2c_viewportScale.y() * vp.xc_height;
|
||||
int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left;
|
||||
int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top;
|
||||
g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight);
|
||||
CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR);
|
||||
float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y) * 2.f;
|
||||
float width = xf2c_viewportScale.x * vp.x8_width;
|
||||
float height = xf2c_viewportScale.y * vp.xc_height;
|
||||
float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y()) * 2.f;
|
||||
float width = xf2c_viewportScale.x() * vp.x8_width;
|
||||
float height = xf2c_viewportScale.y() * vp.xc_height;
|
||||
g_Renderer->SetPerspective(zeus::radToDeg(fov), width, height,
|
||||
cam->GetNearClipDistance(), cam->GetFarClipDistance());
|
||||
zeus::CFrustum frustum;
|
||||
|
@ -1668,9 +1668,9 @@ bool CStateManager::MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterial
|
|||
{
|
||||
zeus::CVector3f crossed =
|
||||
{
|
||||
-ray.dir.z * ray.dir.z - ray.dir.y * ray.dir.x,
|
||||
ray.dir.x * ray.dir.x - ray.dir.z * ray.dir.y,
|
||||
ray.dir.y * ray.dir.y - ray.dir.x * -ray.dir.z
|
||||
-ray.dir.z() * ray.dir.z() - ray.dir.y() * ray.dir.x(),
|
||||
ray.dir.x() * ray.dir.x() - ray.dir.z() * ray.dir.y(),
|
||||
ray.dir.y() * ray.dir.y() - ray.dir.x() * -ray.dir.z()
|
||||
};
|
||||
|
||||
crossed.normalize();
|
||||
|
@ -1702,9 +1702,9 @@ void CStateManager::TestBombHittingWater(const CActor& damager, const zeus::CVec
|
|||
if (TCastToPtr<CScriptWater> water = damagee)
|
||||
{
|
||||
zeus::CAABox bounds = water->GetTriggerBoundsWR();
|
||||
zeus::CVector3f hitPos(pos.x, pos.y, bounds.max.z);
|
||||
zeus::CVector3f hitPos(pos.x(), pos.y(), bounds.max.z());
|
||||
float bombRad = powerBomb ? 4.f : 2.f;
|
||||
float delta = bounds.max.z - pos.dot(zeus::CVector3f::skUp);
|
||||
float delta = bounds.max.z() - pos.dot(zeus::CVector3f::skUp);
|
||||
if (delta <= bombRad && delta > 0.f)
|
||||
{
|
||||
// Below surface
|
||||
|
|
|
@ -324,7 +324,7 @@ void CBallCamera::BuildSplineNav(CStateManager& mgr)
|
|||
float elevation = x1a0_elevation;
|
||||
float distance = x190_curMinDistance;
|
||||
ConstrainElevationAndDistance(elevation, distance, 0.f, mgr);
|
||||
zeus::CVector3f pt1(x35c_splineIntermediatePos.x, x35c_splineIntermediatePos.y, GetTranslation().z);
|
||||
zeus::CVector3f pt1(x35c_splineIntermediatePos.x(), x35c_splineIntermediatePos.y(), GetTranslation().z());
|
||||
x37c_camSpline.AddKnot(pt1, zeus::CVector3f::skForward);
|
||||
zeus::CVector3f pt2 = pt1 + (x35c_splineIntermediatePos - GetTranslation()) * (0.5f + downFactor);
|
||||
x37c_camSpline.AddKnot(pt2, zeus::CVector3f::skForward);
|
||||
|
@ -362,11 +362,11 @@ void CBallCamera::BuildSplineArc(CStateManager& mgr)
|
|||
float distance = x190_curMinDistance;
|
||||
ConstrainElevationAndDistance(elevation, distance, 0.f, mgr);
|
||||
zeus::CVector3f halfwayPoint = (ballPos.toVec2f() - GetTranslation().toVec2f()) * 0.5f + GetTranslation().toVec2f();
|
||||
halfwayPoint.z = GetTranslation().z;
|
||||
halfwayPoint.z() = GetTranslation().z();
|
||||
zeus::CVector3f delta = GetTranslation() - halfwayPoint;
|
||||
zeus::CQuaternion rot;
|
||||
rot.rotateZ(zeus::degToRad(45.f));
|
||||
if (mgr.GetPlayer().GetMoveDir().cross(x34_transform.basis[1]).z >= 0.f)
|
||||
if (mgr.GetPlayer().GetMoveDir().cross(x34_transform.basis[1]).z() >= 0.f)
|
||||
{
|
||||
rot = zeus::CQuaternion();
|
||||
rot.rotateZ(zeus::degToRad(-45.f));
|
||||
|
@ -442,7 +442,7 @@ void CBallCamera::UpdatePlayerMovement(float dt, CStateManager& mgr)
|
|||
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
|
||||
x2f0_ballDelta = ballPos - x2dc_prevBallPos;
|
||||
x2fc_ballDeltaFlat = x2f0_ballDelta;
|
||||
x2fc_ballDeltaFlat.z = 0.f;
|
||||
x2fc_ballDeltaFlat.z() = 0.f;
|
||||
if (x2fc_ballDeltaFlat.canBeNormalized())
|
||||
x2e8_ballVelFlat = x2fc_ballDeltaFlat.magnitude() / dt;
|
||||
else
|
||||
|
@ -450,7 +450,7 @@ void CBallCamera::UpdatePlayerMovement(float dt, CStateManager& mgr)
|
|||
x2dc_prevBallPos = ballPos;
|
||||
x18d_28_obtuseDirection = false;
|
||||
zeus::CVector3f camToBallFlat = ballPos - GetTranslation();
|
||||
camToBallFlat.z = 0.f;
|
||||
camToBallFlat.z() = 0.f;
|
||||
if (camToBallFlat.canBeNormalized())
|
||||
{
|
||||
camToBallFlat.normalize();
|
||||
|
@ -479,7 +479,7 @@ void CBallCamera::UpdateTransform(const zeus::CVector3f& lookDir, const zeus::CV
|
|||
if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr))
|
||||
useLookDir = hint->GetTransform().basis[1];
|
||||
zeus::CVector3f lookDirFlat = useLookDir;
|
||||
lookDirFlat.z = 0.f;
|
||||
lookDirFlat.z() = 0.f;
|
||||
if (!lookDirFlat.canBeNormalized())
|
||||
{
|
||||
SetTranslation(pos);
|
||||
|
@ -545,7 +545,7 @@ zeus::CVector3f CBallCamera::ConstrainYawAngle(const CPlayer& player, float dist
|
|||
CStateManager& mgr) const
|
||||
{
|
||||
zeus::CVector3f playerToCamFlat = GetTranslation() - player.GetTranslation();
|
||||
playerToCamFlat.z = 0.f;
|
||||
playerToCamFlat.z() = 0.f;
|
||||
zeus::CVector3f lookDir = player.GetTransform().basis[1];
|
||||
if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed)
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& hintToLoo
|
|||
return hintToLookDir;
|
||||
zeus::CVector3f hintDir = hint->GetTransform().basis[1];
|
||||
zeus::CVector3f hintDirFlat = hintDir;
|
||||
hintDirFlat.z = 0.f;
|
||||
hintDirFlat.z() = 0.f;
|
||||
if (hintDir.canBeNormalized() && hintDirFlat.canBeNormalized())
|
||||
{
|
||||
hintDir.normalize();
|
||||
|
@ -710,7 +710,7 @@ zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& hintToLoo
|
|||
}
|
||||
|
||||
zeus::CVector3f hintToLookDirFlat = hintToLookDir;
|
||||
hintToLookDirFlat.z = 0.f;
|
||||
hintToLookDirFlat.z() = 0.f;
|
||||
if (hintToLookDir.canBeNormalized() && hintToLookDirFlat.canBeNormalized())
|
||||
hintToLookDirFlat.normalize();
|
||||
else
|
||||
|
@ -723,20 +723,20 @@ zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& hintToLoo
|
|||
attitude = refAttitude + zeus::clamp(-x1ac_attitudeRange, attitude - refAttitude, x1ac_attitudeRange);
|
||||
}
|
||||
|
||||
if (hintToLookDir.z >= 0.f)
|
||||
if (hintToLookDir.z() >= 0.f)
|
||||
attitude = -attitude;
|
||||
|
||||
float azimuth = std::acos(zeus::clamp(-1.f, hintToLookDirFlat.dot(hintDirFlat), 1.f));
|
||||
if (x18c_30_clampAzimuth)
|
||||
azimuth = zeus::clamp(-x1b0_azimuthRange, azimuth, x1b0_azimuthRange);
|
||||
|
||||
if (hintToLookDirFlat.x * hintDirFlat.y - hintDirFlat.x * hintToLookDirFlat.y >= 0.f)
|
||||
if (hintToLookDirFlat.x() * hintDirFlat.y() - hintDirFlat.x() * hintToLookDirFlat.y() >= 0.f)
|
||||
azimuth = -azimuth;
|
||||
|
||||
zeus::CQuaternion quat;
|
||||
quat.rotateZ(azimuth);
|
||||
zeus::CVector3f aziLookDirFlat = quat.transform(hintDirFlat);
|
||||
zeus::CVector3f attitudeAxis(aziLookDirFlat.y, -aziLookDirFlat.x, 0.f);
|
||||
zeus::CVector3f attitudeAxis(aziLookDirFlat.y(), -aziLookDirFlat.x(), 0.f);
|
||||
attitudeAxis.normalize();
|
||||
return zeus::CQuaternion::fromAxisAngle(attitudeAxis, -attitude).transform(aziLookDirFlat);
|
||||
}
|
||||
|
@ -952,12 +952,12 @@ zeus::CVector3f CBallCamera::InterpolateCameraElevation(const zeus::CVector3f& c
|
|||
if (!x18c_31_clearLOS && x350_obscuringMaterial.HasMaterial(EMaterialTypes::Floor))
|
||||
{
|
||||
x3d4_elevInterpTimer = 1.f;
|
||||
ret.z = x3d8_elevInterpStart = GetTranslation().z;
|
||||
ret.z() = x3d8_elevInterpStart = GetTranslation().z();
|
||||
}
|
||||
else if (x3d4_elevInterpTimer > 0.f)
|
||||
{
|
||||
x3d4_elevInterpTimer -= dt;
|
||||
ret.z = (camPos.z - x3d8_elevInterpStart) * (1.f - zeus::clamp(0.f, x3d4_elevInterpTimer, 1.f)) +
|
||||
ret.z() = (camPos.z() - x3d8_elevInterpStart) * (1.f - zeus::clamp(0.f, x3d4_elevInterpTimer, 1.f)) +
|
||||
x3d8_elevInterpStart;
|
||||
}
|
||||
|
||||
|
@ -979,10 +979,10 @@ zeus::CVector3f CBallCamera::CalculateCollidersCentroid(const std::vector<CCamer
|
|||
{
|
||||
if (prevCol->x4c_occlusionCount < 2 && col.x4c_occlusionCount < 2)
|
||||
{
|
||||
float z0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.z;
|
||||
float x1 = prevCol->x50_scale * col.x8_lastLocalPos.x;
|
||||
float x0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.x;
|
||||
float z1 = prevCol->x50_scale * col.x8_lastLocalPos.z;
|
||||
float z0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.z();
|
||||
float x1 = prevCol->x50_scale * col.x8_lastLocalPos.x();
|
||||
float x0 = prevCol->x50_scale * prevCol->x8_lastLocalPos.x();
|
||||
float z1 = prevCol->x50_scale * col.x8_lastLocalPos.z();
|
||||
|
||||
float cross = x0 * z1 - x1 * z0;
|
||||
accumCross += cross;
|
||||
|
@ -1015,29 +1015,29 @@ zeus::CVector3f CBallCamera::ApplyColliders()
|
|||
zeus::CVector3f mediumCentroid = CalculateCollidersCentroid(x274_mediumColliders, x2c8_mediumCollidersObsCount);
|
||||
zeus::CVector3f largeCentroid = CalculateCollidersCentroid(x284_largeColliders, x2cc_largeCollidersObsCount);
|
||||
|
||||
if (smallCentroid.y == 0.f)
|
||||
if (smallCentroid.y() == 0.f)
|
||||
x2a0_smallCentroid = smallCentroid;
|
||||
else
|
||||
x2a0_smallCentroid = zeus::CVector3f::skZero;
|
||||
|
||||
float centroidX = x2a0_smallCentroid.x;
|
||||
float centroidZ = x2a0_smallCentroid.z;
|
||||
float centroidX = x2a0_smallCentroid.x();
|
||||
float centroidZ = x2a0_smallCentroid.z();
|
||||
|
||||
if (mediumCentroid.y == 0.f)
|
||||
if (mediumCentroid.y() == 0.f)
|
||||
x2ac_mediumCentroid = mediumCentroid;
|
||||
else
|
||||
x2ac_mediumCentroid = zeus::CVector3f::skZero;
|
||||
|
||||
centroidX += x2ac_mediumCentroid.x;
|
||||
centroidZ += x2ac_mediumCentroid.z;
|
||||
centroidX += x2ac_mediumCentroid.x();
|
||||
centroidZ += x2ac_mediumCentroid.z();
|
||||
|
||||
if (largeCentroid.y == 0.f)
|
||||
if (largeCentroid.y() == 0.f)
|
||||
x2b8_largeCentroid = largeCentroid;
|
||||
else
|
||||
x2b8_largeCentroid = zeus::CVector3f::skZero;
|
||||
|
||||
centroidX += x2b8_largeCentroid.x;
|
||||
centroidZ += x2b8_largeCentroid.z;
|
||||
centroidX += x2b8_largeCentroid.x();
|
||||
centroidZ += x2b8_largeCentroid.z();
|
||||
|
||||
if (x18c_31_clearLOS)
|
||||
centroidX /= 1.5f;
|
||||
|
@ -1075,10 +1075,10 @@ void CBallCamera::UpdateColliders(const zeus::CTransform& xf, std::vector<CCamer
|
|||
{
|
||||
if (it < colliderList.size())
|
||||
{
|
||||
x310_idealLookVec = {0.f, g_tweakBall->GetBallCameraOffset().y, g_tweakPlayer->GetPlayerBallHalfExtent()};
|
||||
x310_idealLookVec.y *= x308_speedFactor;
|
||||
x31c_predictedLookPos = mgr.GetPlayer().GetMoveDir() * x310_idealLookVec.y;
|
||||
x31c_predictedLookPos.z = x310_idealLookVec.z;
|
||||
x310_idealLookVec = {0.f, g_tweakBall->GetBallCameraOffset().y(), g_tweakPlayer->GetPlayerBallHalfExtent()};
|
||||
x310_idealLookVec.y() *= x308_speedFactor;
|
||||
x31c_predictedLookPos = mgr.GetPlayer().GetMoveDir() * x310_idealLookVec.y();
|
||||
x31c_predictedLookPos.z() = float(x310_idealLookVec.z());
|
||||
x31c_predictedLookPos += mgr.GetPlayer().GetTranslation();
|
||||
zeus::CTransform predictedLookXf = zeus::lookAt(xf.origin, x31c_predictedLookPos);
|
||||
float toleranceRecip = 1.f / tolerance;
|
||||
|
@ -1225,9 +1225,9 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
x2c4_smallCollidersObsCount = CountObscuredColliders(x264_smallColliders);
|
||||
x2c8_mediumCollidersObsCount = CountObscuredColliders(x274_mediumColliders);
|
||||
x2cc_largeCollidersObsCount = CountObscuredColliders(x284_largeColliders);
|
||||
zeus::CVector3f posAtBallLevel = {0.f, 0.f, GetTranslation().z - ballPos.z};
|
||||
zeus::CVector3f posAtBallLevel = {0.f, 0.f, GetTranslation().z() - ballPos.z()};
|
||||
zeus::CVector3f ballToCamFlat = GetTranslation() - ballPos;
|
||||
ballToCamFlat.z = 0.f;
|
||||
ballToCamFlat.z() = 0.f;
|
||||
float ballToCamFlatMag = 0.f;
|
||||
if (ballToCamFlat.canBeNormalized())
|
||||
ballToCamFlatMag = ballToCamFlat.magnitude();
|
||||
|
@ -1240,7 +1240,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
float distance = x214_ballCameraSpring.ApplyDistanceSpring(x190_curMinDistance, ballToCamFlatMag,
|
||||
(3.f + x308_speedFactor) * dt);
|
||||
zeus::CVector3f camToBall = ballPos - GetTranslation();
|
||||
camToBall.z = 0.f;
|
||||
camToBall.z() = 0.f;
|
||||
if (camToBall.canBeNormalized())
|
||||
{
|
||||
camToBall.normalize();
|
||||
|
@ -1309,9 +1309,9 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
g_tweakBall->GetBallCameraBoostYawSpeed(), dt, mgr);
|
||||
}
|
||||
ballToCam.normalize();
|
||||
ballToCam.z = 0.f;
|
||||
ballToCam.z() = 0.f;
|
||||
ballToCam = ballToCam * distance;
|
||||
ballToCam.z = 1.f;
|
||||
ballToCam.z() = 1.f;
|
||||
desiredBallToCam = ballToCam;
|
||||
noDoor = false;
|
||||
}
|
||||
|
@ -1328,10 +1328,10 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
ballToCam = ConstrainYawAngle(mgr.GetPlayer(), g_tweakBall->GetBallCameraChaseDistance(),
|
||||
g_tweakBall->GetBallCameraChaseYawSpeed(), dt, mgr);
|
||||
}
|
||||
ballToCam.z = 0.f;
|
||||
ballToCam.z() = 0.f;
|
||||
ballToCam.normalize();
|
||||
ballToCam = ballToCam * distance;
|
||||
ballToCam.z = g_tweakBall->GetBallCameraElevation();
|
||||
ballToCam.z() = g_tweakBall->GetBallCameraElevation();
|
||||
desiredBallToCam = ballToCam;
|
||||
noDoor = false;
|
||||
}
|
||||
|
@ -1385,7 +1385,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
colliderPointLocal = AvoidGeometry(lookXf, nearList, dt, mgr);
|
||||
|
||||
zeus::CVector3f ballToCam2 = GetTranslation() - ballPos;
|
||||
ballToCam2.z = 0.f;
|
||||
ballToCam2.z() = 0.f;
|
||||
if (ballToCam2.magnitude() < 2.f)
|
||||
{
|
||||
if (x18c_31_clearLOS && x478_shortMoveCount > 2)
|
||||
|
@ -1431,10 +1431,10 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
|
||||
zeus::CVector3f finalPos = posDelta * cDistSpringMag + x294_dampedPos;
|
||||
if (mgr.GetPlayer().GetMorphBall()->GetSpiderBallState() != CMorphBall::ESpiderBallState::Active &&
|
||||
!x18e_24_noElevationVelClamp && mgr.GetPlayer().GetVelocity().z > 8.f)
|
||||
!x18e_24_noElevationVelClamp && mgr.GetPlayer().GetVelocity().z() > 8.f)
|
||||
{
|
||||
zeus::CVector3f delta = finalPos - oldPos;
|
||||
delta.z = zeus::clamp(-0.1f * dt, delta.z, 0.1f * dt);
|
||||
delta.z() = zeus::clamp(-0.1f * dt, float(delta.z()), 0.1f * dt);
|
||||
finalPos = oldPos + delta;
|
||||
}
|
||||
|
||||
|
@ -1442,12 +1442,12 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
finalPos = InterpolateCameraElevation(finalPos, dt);
|
||||
|
||||
if (x18d_29_noElevationInterp)
|
||||
finalPos.z = elevation + ballPos.z;
|
||||
finalPos.z() = elevation + ballPos.z();
|
||||
|
||||
if (ballToCam2.magnitude() < 2.f)
|
||||
{
|
||||
if (finalPos.z < 2.f + ballPos.z)
|
||||
finalPos.z = 2.f + ballPos.z;
|
||||
if (finalPos.z() < 2.f + ballPos.z())
|
||||
finalPos.z() = 2.f + ballPos.z();
|
||||
x214_ballCameraSpring.Reset();
|
||||
}
|
||||
|
||||
|
@ -1457,12 +1457,12 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
|
|||
if (!door->x2a8_26_isOpen)
|
||||
finalPos = GetTranslation();
|
||||
|
||||
float backupZ = finalPos.z;
|
||||
float backupZ = finalPos.z();
|
||||
finalPos = MoveCollisionActor(finalPos, dt, mgr);
|
||||
|
||||
if (x18c_31_clearLOS && x478_shortMoveCount > 0)
|
||||
{
|
||||
finalPos.z = backupZ;
|
||||
finalPos.z() = backupZ;
|
||||
finalPos = MoveCollisionActor(finalPos, dt, mgr);
|
||||
}
|
||||
|
||||
|
@ -1494,11 +1494,11 @@ zeus::CVector3f CBallCamera::ClampElevationToWater(zeus::CVector3f& pos, CStateM
|
|||
zeus::CVector3f ret = pos;
|
||||
if (TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(mgr.GetPlayer().GetFluidId()))
|
||||
{
|
||||
float waterZ = water->GetTriggerBoundsWR().max.z;
|
||||
if (pos.z >= waterZ && pos.z - waterZ <= 0.25f)
|
||||
ret.z = 0.25f + waterZ;
|
||||
else if (pos.z < waterZ && pos.z - waterZ >= -0.12f)
|
||||
ret.z = waterZ - 0.12f;
|
||||
float waterZ = water->GetTriggerBoundsWR().max.z();
|
||||
if (pos.z() >= waterZ && pos.z() - waterZ <= 0.25f)
|
||||
ret.z() = 0.25f + waterZ;
|
||||
else if (pos.z() < waterZ && pos.z() - waterZ >= -0.12f)
|
||||
ret.z() = waterZ - 0.12f;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1512,9 +1512,9 @@ void CBallCamera::UpdateTransitionFromBallCamera(CStateManager& mgr)
|
|||
x47c_failsafeState->x90_splinePoints[2] += delta;
|
||||
x47c_failsafeState->x90_splinePoints[3] += delta;
|
||||
zeus::CVector3f splinePoint = GetFailsafeSplinePoint(x47c_failsafeState->x90_splinePoints, morphFactor);
|
||||
splinePoint.z = (splinePoint.z - eyePos.z) * zeus::clamp(0.f, 1.f - 1.5f * morphFactor, 1.f) + eyePos.z;
|
||||
splinePoint.z() = (splinePoint.z() - eyePos.z()) * zeus::clamp(0.f, 1.f - 1.5f * morphFactor, 1.f) + eyePos.z();
|
||||
zeus::CVector3f deltaFlat = eyePos - splinePoint;
|
||||
deltaFlat.z = 0.f;
|
||||
deltaFlat.z() = 0.f;
|
||||
if (deltaFlat.magnitude() > 0.001f)
|
||||
{
|
||||
SetTransform(zeus::lookAt(splinePoint, zeus::CVector3f::lerp(x1d8_lookPos, eyePos, morphFactor)));
|
||||
|
@ -1539,7 +1539,7 @@ void CBallCamera::UpdateUsingTransitions(float dt, CStateManager& mgr)
|
|||
x18d_26_lookAtBall = false;
|
||||
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
|
||||
zeus::CVector3f eyePos = mgr.GetPlayer().GetEyePosition();
|
||||
ballPos.z += x1b4_lookAtOffset.z;
|
||||
ballPos.z() += x1b4_lookAtOffset.z();
|
||||
|
||||
zeus::CVector3f lookDir = x34_transform.basis[1];
|
||||
zeus::CTransform xe8 = x34_transform;
|
||||
|
@ -1608,16 +1608,16 @@ void CBallCamera::UpdateUsingTransitions(float dt, CStateManager& mgr)
|
|||
yawSpeed = std::fabs(std::acos(zeus::clamp(-1.f, playerToCamDir.dot(-moveDir), 1.f))) * morphT / dt;
|
||||
}
|
||||
zeus::CVector3f useLookDir = ConstrainYawAngle(mgr.GetPlayer(), yawSpeed, zeus::degToRad(10.f), dt, mgr);
|
||||
useLookDir.z = 0.f;
|
||||
useLookDir.z() = 0.f;
|
||||
useLookDir.normalize();
|
||||
zeus::CVector3f camPos = useLookDir * distance + eyePos;
|
||||
camPos.z = (GetTranslation().z - eyePos.z) * morphT + eyePos.z;
|
||||
camPos.z() = (GetTranslation().z() - eyePos.z()) * morphT + eyePos.z();
|
||||
finalPos = ClampElevationToWater(camPos, mgr);
|
||||
finalPos = MoveCollisionActor(finalPos, dt, mgr);
|
||||
zeus::CVector3f finalToBall = ballPos - finalPos;
|
||||
finalToBall.z = 0.f;
|
||||
finalToBall.z() = 0.f;
|
||||
zeus::CVector3f lookPos = ballPos;
|
||||
lookPos.z = morphT * (eyePos.z - ballPos.z) + ballPos.z;
|
||||
lookPos.z() = morphT * (eyePos.z() - ballPos.z()) + ballPos.z();
|
||||
if (finalToBall.canBeNormalized())
|
||||
SetTransform(zeus::lookAt(finalPos, lookPos));
|
||||
else
|
||||
|
@ -1642,7 +1642,7 @@ zeus::CTransform CBallCamera::UpdateCameraPositions(float dt, const zeus::CTrans
|
|||
const zeus::CTransform& newXf)
|
||||
{
|
||||
zeus::CTransform useXf = newXf;
|
||||
if (std::fabs(oldXf.basis[1].z) > 0.9f && std::fabs(newXf.basis[1].z) > 0.9f &&
|
||||
if (std::fabs(oldXf.basis[1].z()) > 0.9f && std::fabs(newXf.basis[1].z()) > 0.9f &&
|
||||
oldXf.basis[0].dot(newXf.basis[0]) <= 0.999f)
|
||||
{
|
||||
zeus::CVector3f newRight = zeus::CQuaternion::clampedRotateTo(oldXf.basis[0], newXf.basis[0],
|
||||
|
@ -1859,9 +1859,9 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation
|
|||
if (!mgr.RayCollideWorld(ballPos, eyePos, BallCameraFilter, nullptr))
|
||||
eyePos = ballPos;
|
||||
|
||||
zeus::CVector3f idealLookVec(0.f, -dist, elev - (eyePos.z - ballPos.z));
|
||||
zeus::CVector3f idealLookVec(0.f, -dist, elev - (eyePos.z() - ballPos.z()));
|
||||
idealLookVec = lookDirXf.getRotation() * idealLookVec;
|
||||
zeus::CVector3f lookVec(0.f, distance, elev - (eyePos.z - ballPos.z));
|
||||
zeus::CVector3f lookVec(0.f, distance, elev - (eyePos.z() - ballPos.z()));
|
||||
float idealLookDist = idealLookVec.magnitude();
|
||||
float resolveLOSIntervalAng = zeus::degToRad(30.f);
|
||||
bool foundClear = false;
|
||||
|
@ -1869,8 +1869,8 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation
|
|||
if (!clear && idealLookDist <= 0.f)
|
||||
{
|
||||
zeus::CAABox x13ac(ballPos - distance, ballPos + distance);
|
||||
x13ac.min.z = ballPos.z;
|
||||
x13ac.max.z = elev + ballPos.z;
|
||||
x13ac.min.z() = float(ballPos.z());
|
||||
x13ac.max.z() = elev + ballPos.z();
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
mgr.BuildNearList(nearList, x13ac, BallCameraFilter,
|
||||
TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr());
|
||||
|
@ -1956,8 +1956,8 @@ zeus::CVector3f CBallCamera::FindDesiredPosition(float distance, float elevation
|
|||
if (!foundClear)
|
||||
{
|
||||
zeus::CAABox findBounds(ballPos - distance, ballPos + distance);
|
||||
findBounds.min.z = ballPos.z;
|
||||
findBounds.max.z = elev + ballPos.z;
|
||||
findBounds.min.z() = float(ballPos.z());
|
||||
findBounds.max.z() = elev + ballPos.z();
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
mgr.BuildNearList(nearList, findBounds, BallCameraFilter,
|
||||
TCastToConstPtr<CActor>(mgr.GetObjectById(x46c_collisionActorId)).GetPtr());
|
||||
|
@ -2263,7 +2263,7 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr)
|
|||
if (player->IsMorphBallTransitioning())
|
||||
{
|
||||
x1d8_lookPos = ballPos;
|
||||
x1d8_lookPos.z += x1b4_lookAtOffset.z;
|
||||
x1d8_lookPos.z() += x1b4_lookAtOffset.z();
|
||||
x1c0_lookPosAhead = x1d8_lookPos;
|
||||
x1cc_fixedLookPos = x1d8_lookPos;
|
||||
}
|
||||
|
@ -2271,21 +2271,21 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr)
|
|||
{
|
||||
zeus::CVector3f dirNorm = player->GetMoveDir();
|
||||
dirNorm.normalize();
|
||||
zeus::CVector3f lookAtOffsetAhead(x308_speedFactor * x1b4_lookAtOffset.x,
|
||||
x308_speedFactor * x1b4_lookAtOffset.y,
|
||||
x1b4_lookAtOffset.z);
|
||||
zeus::CVector3f lookAtOffsetAhead(x308_speedFactor * x1b4_lookAtOffset.x(),
|
||||
x308_speedFactor * x1b4_lookAtOffset.y(),
|
||||
x1b4_lookAtOffset.z());
|
||||
if (x18c_25_chaseAllowed && (x400_state == EBallCameraState::Chase || x400_state == EBallCameraState::One))
|
||||
lookAtOffsetAhead = zeus::CVector3f(x308_speedFactor * x410_chaseLookAtOffset.x,
|
||||
x308_speedFactor * x410_chaseLookAtOffset.y,
|
||||
x410_chaseLookAtOffset.z);
|
||||
lookAtOffsetAhead = zeus::CVector3f(x308_speedFactor * x410_chaseLookAtOffset.x(),
|
||||
x308_speedFactor * x410_chaseLookAtOffset.y(),
|
||||
x410_chaseLookAtOffset.z());
|
||||
if (mgr.GetCameraManager()->IsInterpolationCameraActive())
|
||||
lookAtOffsetAhead = zeus::CVector3f(0.f, 0.f, x1b4_lookAtOffset.z);
|
||||
lookAtOffsetAhead = zeus::CVector3f(0.f, 0.f, x1b4_lookAtOffset.z());
|
||||
zeus::CTransform moveXf = player->CreateTransformFromMovementDirection().getRotation();
|
||||
if (x2fc_ballDeltaFlat.canBeNormalized())
|
||||
lookAtOffsetAhead = moveXf * lookAtOffsetAhead;
|
||||
zeus::CVector3f lookAtPosAhead = ballPos + lookAtOffsetAhead;
|
||||
x1c0_lookPosAhead = lookAtPosAhead;
|
||||
x1cc_fixedLookPos = ballPos + zeus::CVector3f(0.f, 0.f, lookAtOffsetAhead.z);
|
||||
x1cc_fixedLookPos = ballPos + zeus::CVector3f(0.f, 0.f, lookAtOffsetAhead.z());
|
||||
zeus::CVector3f aheadToCurrentLookDelta = x1d8_lookPos - lookAtPosAhead;
|
||||
float aheadToCurrentLookMag = aheadToCurrentLookDelta.magnitude();
|
||||
if (aheadToCurrentLookDelta.canBeNormalized())
|
||||
|
@ -2298,7 +2298,7 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr)
|
|||
if (x18d_26_lookAtBall)
|
||||
{
|
||||
x1d8_lookPos = ballPos;
|
||||
x1d8_lookPos.z += x1b4_lookAtOffset.z;
|
||||
x1d8_lookPos.z() += x1b4_lookAtOffset.z();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2330,9 +2330,9 @@ void CBallCamera::UpdateLookAtPosition(float dt, CStateManager& mgr)
|
|||
}
|
||||
if (x18d_30_directElevation)
|
||||
{
|
||||
x1d8_lookPos.z = ballPos.z + x1b4_lookAtOffset.z;
|
||||
x1c0_lookPosAhead.z = x1d8_lookPos.z;
|
||||
x1cc_fixedLookPos.z = x1d8_lookPos.z;
|
||||
x1d8_lookPos.z() = ballPos.z() + x1b4_lookAtOffset.z();
|
||||
x1c0_lookPosAhead.z() = float(x1d8_lookPos.z());
|
||||
x1cc_fixedLookPos.z() = float(x1d8_lookPos.z());
|
||||
}
|
||||
if (x18d_31_overrideLookDir)
|
||||
{
|
||||
|
@ -2426,7 +2426,7 @@ void CBallCamera::ApplyCameraHint(CStateManager& mgr)
|
|||
{
|
||||
float distance = hint->GetHint().GetBallToCam().toVec2f().magnitude();
|
||||
zeus::CVector3f camToBall = -zeus::CVector3f(hint->GetHint().GetBallToCam().toVec2f()).normalized();
|
||||
camPos = FindDesiredPosition(distance, hint->GetHint().GetBallToCam().z, camToBall, mgr, false);
|
||||
camPos = FindDesiredPosition(distance, hint->GetHint().GetBallToCam().z(), camToBall, mgr, false);
|
||||
}
|
||||
TeleportCamera(zeus::lookAt(camPos, x1d8_lookPos), mgr);
|
||||
break;
|
||||
|
@ -2446,7 +2446,7 @@ void CBallCamera::ApplyCameraHint(CStateManager& mgr)
|
|||
{
|
||||
zeus::CVector3f lookDir = mgr.GetPlayer().GetTranslation() -
|
||||
mgr.GetCameraManager()->GetCurrentCameraTransform(mgr).origin;
|
||||
lookDir.z = 0.f;
|
||||
lookDir.z() = 0.f;
|
||||
if (lookDir.canBeNormalized())
|
||||
lookDir.normalize();
|
||||
else
|
||||
|
@ -2493,7 +2493,7 @@ void CBallCamera::ApplyCameraHint(CStateManager& mgr)
|
|||
void CBallCamera::ResetPosition(CStateManager& mgr)
|
||||
{
|
||||
x1d8_lookPos = mgr.GetPlayer().GetBallPosition();
|
||||
x1d8_lookPos.z += x1b4_lookAtOffset.z;
|
||||
x1d8_lookPos.z() += x1b4_lookAtOffset.z();
|
||||
x1c0_lookPosAhead = x1d8_lookPos;
|
||||
x1cc_fixedLookPos = x1d8_lookPos;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape,
|
|||
if (x0_curType == EFilterType::Multiply)
|
||||
x1c_nextColor = zeus::CColor::skWhite;
|
||||
else if (x0_curType == EFilterType::Add || x0_curType == EFilterType::Blend)
|
||||
x1c_nextColor.a = 0.f;
|
||||
x1c_nextColor.a() = 0.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape,
|
|||
else if (type == EFilterType::Add || type == EFilterType::Blend)
|
||||
{
|
||||
x18_curColor = x1c_nextColor;
|
||||
x18_curColor.a = 0.f;
|
||||
x18_curColor.a() = 0.f;
|
||||
x14_prevColor = x18_curColor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ void CCameraManager::RestoreHintlessCamera(CStateManager& mgr)
|
|||
if (hint)
|
||||
{
|
||||
zeus::CVector3f camToPlayerFlat = mgr.GetPlayer().GetTranslation() - ballCamXf.origin;
|
||||
camToPlayerFlat.z = 0.f;
|
||||
camToPlayerFlat.z() = 0.f;
|
||||
if (camToPlayerFlat.canBeNormalized())
|
||||
camToPlayerFlat.normalize();
|
||||
else
|
||||
|
|
|
@ -199,9 +199,9 @@ void CCinematicCamera::Think(float dt, CStateManager& mgr)
|
|||
{
|
||||
zeus::CVector3f target = mgr.GetPlayer().GetTranslation();
|
||||
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed)
|
||||
target.z += mgr.GetPlayer().GetMorphBall()->GetBallRadius();
|
||||
target.z() += mgr.GetPlayer().GetMorphBall()->GetBallRadius();
|
||||
else
|
||||
target.z += mgr.GetPlayer().GetEyeHeight();
|
||||
target.z() += mgr.GetPlayer().GetEyeHeight();
|
||||
|
||||
zeus::CVector3f upVec = orientation.transform(zeus::CVector3f::skUp);
|
||||
if ((target - viewPoint).toVec2f().magnitude() < 0.0011920929f)
|
||||
|
|
|
@ -85,12 +85,12 @@ void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransf
|
|||
float dt, zeus::CVector3f& rVec)
|
||||
{
|
||||
zeus::CVector3f gunFrontVec = x190_gunFollowXf.frontVector();
|
||||
gunFrontVec.z = 0.f;
|
||||
gunFrontVec.z() = 0.f;
|
||||
if (gunFrontVec.canBeNormalized())
|
||||
gunFrontVec.normalize();
|
||||
|
||||
zeus::CVector3f rVecNoZ = rVec;
|
||||
rVecNoZ.z = 0.f;
|
||||
rVecNoZ.z() = 0.f;
|
||||
if (rVecNoZ.canBeNormalized())
|
||||
rVecNoZ.normalize();
|
||||
|
||||
|
@ -124,12 +124,12 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
float angleClamp = g_tweakPlayer->GetVerticalFreeLookAngleVel() - std::fabs(x1c0_pitch);
|
||||
angle = zeus::clamp(-angleClamp, angle, angleClamp);
|
||||
zeus::CVector3f vec;
|
||||
vec.z = std::sin(angle);
|
||||
vec.y = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle);
|
||||
vec.x = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle);
|
||||
vec.z() = std::sin(angle);
|
||||
vec.y() = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle);
|
||||
vec.x() = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle);
|
||||
if (g_tweakPlayer->GetFreeLookTurnsPlayer())
|
||||
{
|
||||
vec.x = 0.f;
|
||||
vec.x() = 0.f;
|
||||
if (!zeus::close_enough(vec, zeus::CVector3f::skZero))
|
||||
vec.normalize();
|
||||
}
|
||||
|
@ -185,9 +185,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
g_tweakPlayer->GetJumpCameraPitchDownFull(), 1.f) *
|
||||
g_tweakPlayer->GetJumpCameraPitchDownAngle();
|
||||
angle += x1c0_pitch;
|
||||
rVec.x = 0.f;
|
||||
rVec.y = std::cos(angle);
|
||||
rVec.z = -std::sin(angle);
|
||||
rVec.x() = 0.f;
|
||||
rVec.y() = std::cos(angle);
|
||||
rVec.z() = -std::sin(angle);
|
||||
|
||||
rVec = playerXf.rotate(rVec);
|
||||
}
|
||||
|
@ -196,9 +196,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
float angle = zeus::clamp(0.f, (player->x29c_fallCameraTimer - g_tweakPlayer->GetFallCameraPitchDownStart()) /
|
||||
g_tweakPlayer->GetFallCameraPitchDownFull(), 1.f) *
|
||||
g_tweakPlayer->GetFallCameraPitchDownAngle();
|
||||
rVec.x = 0.f;
|
||||
rVec.y = std::cos(angle);
|
||||
rVec.z = -std::sin(angle);
|
||||
rVec.x() = 0.f;
|
||||
rVec.y() = std::cos(angle);
|
||||
rVec.z() = -std::sin(angle);
|
||||
|
||||
rVec = playerXf.rotate(rVec);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
gunFrontVec.normalize();
|
||||
|
||||
zeus::CVector3f rVecCpy = rVec;
|
||||
rVecCpy.z = 0.f;
|
||||
rVecCpy.z() = 0.f;
|
||||
if (rVecCpy.canBeNormalized())
|
||||
rVecCpy.normalize();
|
||||
|
||||
|
@ -290,12 +290,12 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
else
|
||||
{
|
||||
zeus::CVector3f gunFront = x190_gunFollowXf.frontVector();
|
||||
gunFront.z = 0.f;
|
||||
gunFront.z() = 0.f;
|
||||
if (gunFront.canBeNormalized())
|
||||
gunFront.normalize();
|
||||
|
||||
zeus::CVector3f rVecCpy = rVec;
|
||||
rVecCpy.z = 0.f;
|
||||
rVecCpy.z() = 0.f;
|
||||
if (rVecCpy.canBeNormalized())
|
||||
rVecCpy.normalize();
|
||||
|
||||
|
@ -342,12 +342,12 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr)
|
|||
if (TCastToConstPtr<CScriptCameraPitchVolume> pvol = mgr.GetObjectById(x1c4_pitchId))
|
||||
{
|
||||
zeus::CVector3f pitchDirFlat = pvol->GetTransform().basis[1];
|
||||
pitchDirFlat.z = 0.f;
|
||||
pitchDirFlat.z() = 0.f;
|
||||
if (!pitchDirFlat.canBeNormalized())
|
||||
pitchDirFlat = zeus::CVector3f::skForward;
|
||||
|
||||
zeus::CVector3f playerDirFlat = player->GetTransform().basis[1];
|
||||
playerDirFlat.z = 0.f;
|
||||
playerDirFlat.z() = 0.f;
|
||||
playerDirFlat.normalize();
|
||||
|
||||
float pitchDot = zeus::clamp(-1.f, pitchDirFlat.dot(playerDirFlat), 1.f);
|
||||
|
@ -357,7 +357,7 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr)
|
|||
x1c0_pitch = pvol->GetUpPitch() * -pitchDot;
|
||||
|
||||
zeus::CVector3f pvolToPlayerFlat = player->GetTranslation() - pvol->GetTranslation();
|
||||
pvolToPlayerFlat.z = 0.f;
|
||||
pvolToPlayerFlat.z() = 0.f;
|
||||
float pitchMul = 0.f;
|
||||
if (pvolToPlayerFlat.canBeNormalized())
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr)
|
|||
pitchMul = 1.f;
|
||||
else
|
||||
pitchMul = 1.f - zeus::clamp(-1.f, (pvolPlayerProj - pvol->GetMaxInterpolationDistance()) /
|
||||
(pvol->GetScale().y - pvol->GetMaxInterpolationDistance()), 1.f);
|
||||
(pvol->GetScale().y() - pvol->GetMaxInterpolationDistance()), 1.f);
|
||||
}
|
||||
x1c0_pitch *= pitchMul;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ zeus::CVector3f CGameCamera::ConvertToScreenSpace(const zeus::CVector3f& v) cons
|
|||
if (rVec.isZero())
|
||||
return {-1.f, -1.f, 1.f};
|
||||
|
||||
rVec = zeus::CVector3f(rVec.x, rVec.z, -rVec.y);
|
||||
rVec = zeus::CVector3f(rVec.x(), rVec.z(), -rVec.y());
|
||||
zeus::CMatrix4f mtx = GetPerspectiveMatrix();
|
||||
return mtx.multiplyOneOverW(rVec);
|
||||
}
|
||||
|
@ -84,11 +84,11 @@ zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& ne
|
|||
if (std::fabs(f2) > 0.999f)
|
||||
xfCpy = oldXf;
|
||||
|
||||
if (xfCpy.upVector().z < -0.2f)
|
||||
if (xfCpy.upVector().z() < -0.2f)
|
||||
xfCpy = zeus::CQuaternion::fromAxisAngle(xfCpy.frontVector(), M_PIF).toTransform() * xfCpy;
|
||||
|
||||
if (!zeus::close_enough(xfCpy.rightVector().z, 0.f) &&
|
||||
!zeus::close_enough(xfCpy.upVector().z, 0.f))
|
||||
if (!zeus::close_enough(xfCpy.rightVector().z(), 0.f) &&
|
||||
!zeus::close_enough(xfCpy.upVector().z(), 0.f))
|
||||
{
|
||||
if (xfCpy.frontVector().canBeNormalized())
|
||||
xfCpy = zeus::lookAt(zeus::CVector3f::skZero, xfCpy.frontVector());
|
||||
|
|
|
@ -131,7 +131,7 @@ bool CInterpolationCamera::InterpolateSinusoidal(zeus::CTransform& xf, const zeu
|
|||
else
|
||||
lookDir = x34_transform.basis[1];
|
||||
zeus::CVector3f lookDirFlat = lookDir;
|
||||
lookDirFlat.z = 0.f;
|
||||
lookDirFlat.z() = 0.f;
|
||||
if (lookDirFlat.canBeNormalized())
|
||||
{
|
||||
t = zeus::clamp(-1.f, t, 1.f);
|
||||
|
@ -209,7 +209,7 @@ bool CInterpolationCamera::InterpolateWithDistance(zeus::CTransform& xf, const z
|
|||
float ang = zeus::clamp(-1.f, std::acos(lookProj) / (M_PIF / 6.f), 1.f) * rotationSpeed * dt;
|
||||
|
||||
zeus::CVector3f lookDirFlat = lookDir;
|
||||
lookDirFlat.z = 0.f;
|
||||
lookDirFlat.z() = 0.f;
|
||||
bool rotationFail = false;
|
||||
if (lookDirFlat.canBeNormalized())
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ void CPathCamera::Think(float dt, CStateManager& mgr)
|
|||
if ((x1ec_flags & 0x10))
|
||||
{
|
||||
if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr))
|
||||
ballLook.z = hint->GetTranslation().z;
|
||||
ballLook.z() = hint->GetTranslation().z();
|
||||
}
|
||||
|
||||
if (!mgr.GetPlayer().GetVelocity().canBeNormalized() && (ballLook - GetTranslation()).canBeNormalized())
|
||||
|
@ -74,7 +74,7 @@ void CPathCamera::Think(float dt, CStateManager& mgr)
|
|||
ClampToClosedDoor(mgr);
|
||||
|
||||
zeus::CVector3f tmp = ballLook - GetTranslation();
|
||||
tmp.z = 0.f;
|
||||
tmp.z() = 0.f;
|
||||
if (tmp.canBeNormalized())
|
||||
SetTransform(zeus::lookAt(GetTranslation(), ballLook));
|
||||
|
||||
|
@ -168,7 +168,7 @@ zeus::CTransform CPathCamera::MoveAlongSpline(float t, CStateManager& mgr)
|
|||
zeus::CVector3f splineToPlayer = mgr.GetPlayer().GetTranslation() -
|
||||
x188_spline.GetInterpolatedSplinePointByLength(x1d8_time).origin;
|
||||
float distToPlayer = 0.f;
|
||||
splineToPlayer.z = 0.f;
|
||||
splineToPlayer.z() = 0.f;
|
||||
if (splineToPlayer.canBeNormalized())
|
||||
distToPlayer = splineToPlayer.magnitude();
|
||||
float easedDistT = (distToPlayer - x1f0_minEaseDist) / (x1f4_maxEaseDist - x1f0_minEaseDist);
|
||||
|
|
|
@ -81,10 +81,10 @@ void CActorLights::BuildFaceLightList(const CStateManager& mgr, const CGameArea&
|
|||
zeus::CVector3f camToExplo = explosion->GetTranslation() - fpTransform.origin;
|
||||
if (fpTransform.transposeRotate(camToExplo).dot(zeus::CVector3f::skForward) >= 0.f)
|
||||
{
|
||||
camToExplo.y = -camToExplo.y + ITweakGui::FaceReflectionDistanceDebugValueToActualValue(
|
||||
g_tweakGui->GetFaceReflectionDistance());
|
||||
camToExplo.z = -camToExplo.z + ITweakGui::FaceReflectionHeightDebugValueToActualValue(
|
||||
g_tweakGui->GetFaceReflectionHeight());
|
||||
camToExplo.y() = -camToExplo.y() + ITweakGui::FaceReflectionDistanceDebugValueToActualValue(
|
||||
g_tweakGui->GetFaceReflectionDistance());
|
||||
camToExplo.z() = -camToExplo.z() + ITweakGui::FaceReflectionHeightDebugValueToActualValue(
|
||||
g_tweakGui->GetFaceReflectionHeight());
|
||||
explosionLight.SetPosition(fpTransform * camToExplo);
|
||||
zeus::CSphere sphere(originalLight.GetPosition(), originalLight.GetRadius());
|
||||
if (aabb.intersects(sphere))
|
||||
|
@ -140,7 +140,7 @@ void CActorLights::AddOverflowToLights(const CLight& light, const zeus::CColor&
|
|||
|
||||
mag = 1.f / mag;
|
||||
zeus::CColor useColor = color * mag;
|
||||
useColor.a = 1.f;
|
||||
useColor.a() = 1.f;
|
||||
x0_areaLights.push_back(CLight::BuildCustom(light.GetPosition() * mag, light.GetDirection() * mag, useColor,
|
||||
light.GetAttenuationConstant() * mag,
|
||||
light.GetAttenuationLinear() * mag,
|
||||
|
@ -155,15 +155,15 @@ void CActorLights::MoveAmbienceToLights(const zeus::CColor& color)
|
|||
if (x298_29_ambienceGenerated)
|
||||
{
|
||||
x288_ambientColor += color * 0.333333f;
|
||||
x288_ambientColor.a = 1.f;
|
||||
x288_ambientColor.a() = 1.f;
|
||||
return;
|
||||
}
|
||||
|
||||
zeus::CColor useColor = x0_areaLights[0].GetColor() + color;
|
||||
float maxComponent = std::max(useColor.r, std::max(useColor.g, useColor.b));
|
||||
float maxComponent = std::max(useColor.r(), std::max(useColor.g(), useColor.b()));
|
||||
if (maxComponent > FLT_EPSILON)
|
||||
useColor *= (1.f / maxComponent);
|
||||
useColor.a = 1.f;
|
||||
useColor.a() = 1.f;
|
||||
x0_areaLights[0].SetColor(useColor);
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ void CActorLights::MultiplyLightingLevels(float level)
|
|||
{
|
||||
zeus::CColor color = light.GetColor();
|
||||
color *= level;
|
||||
color.a = 1.f;
|
||||
color.a() = 1.f;
|
||||
light.SetColor(color);
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
|
|||
SLightValue& value = valList.back();
|
||||
value.x0_areaLightIdx = lightIdx;
|
||||
value.x4_color = light.GetNormalIndependentLightingAtPoint(vec);
|
||||
value.x4_color.a = 0.f;
|
||||
value.x4_color.a() = 0.f;
|
||||
value.x10_colorMag = value.x4_color.magnitude();
|
||||
value.x18_visiblity = visible;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
|
|||
if (x298_27_findShadowLight)
|
||||
{
|
||||
/* Accumulate magnitudes up to most intense for shadow dynamic range check */
|
||||
x288_ambientColor.a = 0.f;
|
||||
x288_ambientColor.a() = 0.f;
|
||||
float mag = x288_ambientColor.magnitude();
|
||||
for (auto it = valList.rbegin() ; it != valList.rend() ; ++it)
|
||||
{
|
||||
|
@ -436,13 +436,13 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
|
|||
MoveAmbienceToLights(overflowAmbColor);
|
||||
|
||||
/* Clamp ambient color */
|
||||
if (x288_ambientColor.r > 1.f)
|
||||
x288_ambientColor.r = 1.f;
|
||||
if (x288_ambientColor.g > 1.f)
|
||||
x288_ambientColor.g = 1.f;
|
||||
if (x288_ambientColor.b > 1.f)
|
||||
x288_ambientColor.b = 1.f;
|
||||
x288_ambientColor.a = 1.f;
|
||||
if (x288_ambientColor.r() > 1.f)
|
||||
x288_ambientColor.r() = 1.f;
|
||||
if (x288_ambientColor.g() > 1.f)
|
||||
x288_ambientColor.g() = 1.f;
|
||||
if (x288_ambientColor.b() > 1.f)
|
||||
x288_ambientColor.b() = 1.f;
|
||||
x288_ambientColor.a() = 1.f;
|
||||
|
||||
/* Multiply down lighting with world fader level */
|
||||
if (worldLightingLevel < 1.f)
|
||||
|
@ -534,7 +534,7 @@ std::vector<CLight> CActorLights::BuildLightVector() const
|
|||
lights.push_back(light);
|
||||
|
||||
zeus::CColor ambColor = x288_ambientColor;
|
||||
ambColor.a = 1.f;
|
||||
ambColor.a() = 1.f;
|
||||
lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, ambColor));
|
||||
|
||||
return lights;
|
||||
|
|
|
@ -55,13 +55,13 @@ pas::EAnimationState CABSAim::UpdateBody(float dt, CBodyController& bc, CStateMa
|
|||
{
|
||||
CAnimData& animData = *bc.GetOwner().ModelData()->AnimationData();
|
||||
|
||||
float hAngle = zeus::clamp(-x18_angles[0], std::atan2(target.x, target.y), x18_angles[1]);
|
||||
float hAngle = zeus::clamp(-x18_angles[0], std::atan2(target.x(), target.y()), x18_angles[1]);
|
||||
hAngle *= 0.63661975f;
|
||||
hAngle = zeus::clamp(-3.f, (hAngle - x28_hWeight) * 0.25f / dt, 3.f);
|
||||
x2c_hWeightVel += dt * zeus::clamp(-10.f, (hAngle - x2c_hWeightVel) / dt, 10.f);
|
||||
|
||||
float hypotenuse = std::sqrt(target.y * target.y + target.x * target.x);
|
||||
float vAngle = zeus::clamp(-x18_angles[3], std::atan2(target.z, hypotenuse), x18_angles[2]);
|
||||
float hypotenuse = std::sqrt(target.y() * target.y() + target.x() * target.x());
|
||||
float vAngle = zeus::clamp(-x18_angles[3], std::atan2(target.z(), hypotenuse), x18_angles[2]);
|
||||
vAngle *= 0.63661975f;
|
||||
vAngle = zeus::clamp(-3.f, (vAngle - x30_vWeight) * 0.25f / dt, 3.f);
|
||||
x34_vWeightVel += dt * zeus::clamp(-10.f, (vAngle - x34_vWeightVel) / dt, 10.f);
|
||||
|
|
|
@ -97,6 +97,15 @@ CAnimData::CAnimData(CAssetId id,
|
|||
x1f8_animRoot = treeNode;
|
||||
}
|
||||
|
||||
void CAnimData::SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr)
|
||||
{
|
||||
auto search = std::find_if(xc_charInfo.x98_effects.begin(), xc_charInfo.x98_effects.end(),
|
||||
[effectName](const auto& v) { return v.first == effectName; });
|
||||
if (search != xc_charInfo.x98_effects.end())
|
||||
for (const auto& p : search->second)
|
||||
x120_particleDB.SetParticleEffectState(p.GetComponentName(), active, mgr);
|
||||
}
|
||||
|
||||
void CAnimData::InitializeEffects(CStateManager& mgr, TAreaId aId, const zeus::CVector3f& scale)
|
||||
{
|
||||
for (const auto& effects : xc_charInfo.GetEffectList())
|
||||
|
|
|
@ -164,6 +164,7 @@ public:
|
|||
const TLockedToken<CCharacterFactory>& charFactory,
|
||||
int drawInstCount);
|
||||
|
||||
void SetParticleEffectState(std::string_view effectName, bool active, CStateManager& mgr);
|
||||
void InitializeEffects(CStateManager&, TAreaId, const zeus::CVector3f&);
|
||||
CAssetId GetEventResourceIdForAnimResourceId(CAssetId) const;
|
||||
void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet);
|
||||
|
|
|
@ -30,18 +30,18 @@ void RotationAndOffsetStorage::CopyRotationsAndOffsets(const std::vector<zeus::C
|
|||
for (u32 j=0 ; j<rotsPerFrame ; ++j)
|
||||
{
|
||||
const zeus::CQuaternion& rot = *rit++;
|
||||
arrOut[0] = rot.w;
|
||||
arrOut[1] = rot.x;
|
||||
arrOut[2] = rot.y;
|
||||
arrOut[3] = rot.z;
|
||||
arrOut[0] = rot.w();
|
||||
arrOut[1] = rot.x();
|
||||
arrOut[2] = rot.y();
|
||||
arrOut[3] = rot.z();
|
||||
arrOut += 4;
|
||||
}
|
||||
for (u32 j=0 ; j<offsPerFrame ; ++j)
|
||||
{
|
||||
const zeus::CVector3f& off = *oit++;
|
||||
arrOut[0] = off.x;
|
||||
arrOut[1] = off.y;
|
||||
arrOut[2] = off.z;
|
||||
arrOut[0] = off.x();
|
||||
arrOut[1] = off.y();
|
||||
arrOut[2] = off.z();
|
||||
arrOut += 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ void CBodyController::FaceDirection(const zeus::CVector3f& v0, float dt)
|
|||
if (x300_26_frozen)
|
||||
return;
|
||||
zeus::CVector3f noZ = v0;
|
||||
noZ.z = 0.f;
|
||||
noZ.z() = 0.f;
|
||||
if (noZ.canBeNormalized())
|
||||
{
|
||||
if (TCastToPtr<CPhysicsActor> act = x0_actor)
|
||||
|
|
|
@ -120,7 +120,7 @@ void CBSProjectileAttack::Start(CBodyController& bc, CStateManager& mgr)
|
|||
zeus::CVector3f localDelta =
|
||||
bc.GetOwner().GetTransform().transposeRotate(cmd->GetTargetPosition() -
|
||||
bc.GetOwner().GetTranslation());
|
||||
zeus::CRelAngle angle = std::atan2(localDelta.y, localDelta.x);
|
||||
zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x());
|
||||
float attackAngle = angle.asDegrees();
|
||||
CPASAnimParmData parms(18, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())),
|
||||
CPASAnimParm::FromReal32(angle.asDegrees()),
|
||||
|
@ -217,7 +217,7 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr)
|
|||
const CBCKnockDownCmd* cmd =
|
||||
static_cast<const CBCKnockDownCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown));
|
||||
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y, localDir.z);
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z());
|
||||
CPASAnimParmData parms(0, CPASAnimParm::FromReal32(angle.asDegrees()),
|
||||
CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity())));
|
||||
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
||||
|
@ -320,7 +320,7 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr)
|
|||
const CBCKnockBackCmd* cmd =
|
||||
static_cast<const CBCKnockBackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack));
|
||||
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y, localDir.x);
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
|
||||
CPASAnimParmData parms(6, CPASAnimParm::FromReal32(angle.asDegrees()),
|
||||
CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity())));
|
||||
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
||||
|
@ -471,11 +471,10 @@ pas::EAnimationState CBSStep::UpdateBody(float dt, CBodyController& bc, CStateMa
|
|||
void CBSTurn::Start(CBodyController& bc, CStateManager& mgr)
|
||||
{
|
||||
const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1];
|
||||
zeus::CVector2f lookDir2d(lookDir.x, lookDir.y);
|
||||
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().x,
|
||||
bc.GetCommandMgr().GetFaceVector().y);
|
||||
zeus::CVector2f lookDir2d(lookDir.toVec2f());
|
||||
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f());
|
||||
float deltaAngle = zeus::radToDeg(zeus::CVector2f::getAngleDiff(lookDir2d, x8_dest));
|
||||
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y, -lookDir2d.x).dot(x8_dest) > 0.f);
|
||||
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f);
|
||||
CPASAnimParmData parms(8, CPASAnimParm::FromEnum(s32(x10_turnDir)),
|
||||
CPASAnimParm::FromReal32(deltaAngle),
|
||||
CPASAnimParm::FromEnum(s32(bc.GetLocomotionType())));
|
||||
|
@ -493,8 +492,8 @@ void CBSTurn::Start(CBodyController& bc, CStateManager& mgr)
|
|||
bool CBSTurn::FacingDest(CBodyController& bc) const
|
||||
{
|
||||
const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1];
|
||||
zeus::CVector2f lookDir2d(lookDir.x, lookDir.y);
|
||||
zeus::CVector2f leftDir(lookDir2d.y, -lookDir2d.x);
|
||||
zeus::CVector2f lookDir2d(lookDir.toVec2f());
|
||||
zeus::CVector2f leftDir(lookDir2d.y(), -lookDir2d.x());
|
||||
if (x10_turnDir == pas::ETurnDirection::Left)
|
||||
{
|
||||
if (leftDir.dot(x8_dest) < 0.f)
|
||||
|
@ -561,11 +560,10 @@ void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr)
|
|||
}
|
||||
else
|
||||
{
|
||||
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().x,
|
||||
bc.GetCommandMgr().GetFaceVector().y);
|
||||
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f());
|
||||
const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1];
|
||||
zeus::CVector2f lookDir2d(lookDir.x, lookDir.y);
|
||||
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y, -lookDir2d.x).dot(x8_dest) > 0.f);
|
||||
zeus::CVector2f lookDir2d(lookDir.toVec2f());
|
||||
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f);
|
||||
CPASAnimParmData parms(5, CPASAnimParm::FromEnum(0),
|
||||
CPASAnimParm::FromEnum(s32(bc.GetLocomotionType())));
|
||||
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
||||
|
@ -590,13 +588,12 @@ pas::EAnimationState CBSFlyerTurn::UpdateBody(float dt, CBodyController& bc, CSt
|
|||
{
|
||||
if (!bc.GetCommandMgr().GetFaceVector().isZero())
|
||||
{
|
||||
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().x,
|
||||
bc.GetCommandMgr().GetFaceVector().y);
|
||||
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f());
|
||||
const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1];
|
||||
zeus::CVector2f lookDir2d(lookDir.x, lookDir.y);
|
||||
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y, -lookDir2d.x).dot(x8_dest) > 0.f);
|
||||
zeus::CVector2f lookDir2d(lookDir.toVec2f());
|
||||
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f);
|
||||
}
|
||||
bc.FaceDirection(zeus::CVector3f(x8_dest.x, x8_dest.y, 0.f), dt);
|
||||
bc.FaceDirection(zeus::CVector3f(x8_dest.x(), x8_dest.y(), 0.f), dt);
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
@ -869,7 +866,7 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr)
|
|||
const CBCKnockBackCmd* cmd =
|
||||
static_cast<const CBCKnockBackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack));
|
||||
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y, localDir.x);
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
|
||||
CPASAnimParmData parms(11, CPASAnimParm::FromEnum(s32(bc.GetFallState())),
|
||||
CPASAnimParm::FromReal32(angle.asDegrees()));
|
||||
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
||||
|
@ -1022,7 +1019,7 @@ bool CBSJump::CheckForWallJump(CBodyController& bc, CStateManager& mgr)
|
|||
{
|
||||
float distToWall = (xc_waypoint1 - act->GetTranslation()).magnitude();
|
||||
zeus::CAABox aabb = act->GetBoundingBox();
|
||||
float xExtent = (aabb.max.x - aabb.min.x) * 0.5f;
|
||||
float xExtent = (aabb.max.x() - aabb.min.x()) * 0.5f;
|
||||
if (distToWall < 1.414f * xExtent || (act->CanLongJump() && distToWall < 3.f * xExtent))
|
||||
{
|
||||
x4_state = x30_26_wallBounceRight ? pas::EJumpState::WallBounceRight : pas::EJumpState::WallBounceLeft;
|
||||
|
@ -1143,8 +1140,8 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa
|
|||
if (TCastToPtr<CPatterned> act = bc.GetOwner())
|
||||
{
|
||||
zeus::CVector3f toFinal = x24_waypoint2 - act->GetTranslation();
|
||||
float tmp = std::sqrt(act->GetGravityConstant() / (2.f * toFinal.z));
|
||||
act->SetVelocityWR(zeus::CVector3f(tmp * toFinal.x, tmp * toFinal.y, 0.f));
|
||||
float tmp = std::sqrt(act->GetGravityConstant() / (2.f * toFinal.z()));
|
||||
act->SetVelocityWR(zeus::CVector3f(tmp * toFinal.x(), tmp * toFinal.y(), 0.f));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1184,7 +1181,7 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr)
|
|||
static_cast<const CBCHurledCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled));
|
||||
x4_state = pas::EHurledState(cmd->GetSkipLaunchState());
|
||||
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y, localDir.x);
|
||||
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
|
||||
x8_knockAngle = angle.asDegrees();
|
||||
CPASAnimParmData parms(14, CPASAnimParm::FromInt32(-1),
|
||||
CPASAnimParm::FromReal32(x8_knockAngle),
|
||||
|
@ -1291,7 +1288,7 @@ bool CBSHurled::ShouldStartLand(float dt, CBodyController& bc) const
|
|||
if (ai->IsOnGround())
|
||||
return true;
|
||||
if (zeus::close_enough(ai->GetTranslation(), x1c_lastTranslation, 0.0001f) &&
|
||||
ai->GetVelocity().z < 0.f)
|
||||
ai->GetVelocity().z() < 0.f)
|
||||
{
|
||||
x28_landedDur += dt;
|
||||
if (x28_landedDur >= 0.25f)
|
||||
|
@ -1406,7 +1403,7 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr)
|
|||
const CBCSlideCmd* cmd =
|
||||
static_cast<const CBCSlideCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Slide));
|
||||
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetSlideDirection());
|
||||
float angle = std::atan2(localDir.y, localDir.x);
|
||||
float angle = std::atan2(localDir.y(), localDir.x());
|
||||
CPASAnimParmData parms(15, CPASAnimParm::FromEnum(s32(cmd->GetSlideType())),
|
||||
CPASAnimParm::FromReal32(zeus::radToDeg(angle)));
|
||||
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
|
||||
|
@ -1733,12 +1730,12 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
|
|||
if (TCastToPtr<CActor> wp = mgr.ObjectById(x8_wpId))
|
||||
{
|
||||
zeus::CVector3f toWp = wp->GetTranslation() - act->GetTranslation();
|
||||
if (toWp.z > 0.f)
|
||||
if (toWp.z() > 0.f)
|
||||
{
|
||||
float tmp = -act->GetMomentum().z / act->GetMass();
|
||||
float tmp2 = std::sqrt(tmp * 2.f * toWp.z);
|
||||
float tmp = -act->GetMomentum().z() / act->GetMass();
|
||||
float tmp2 = std::sqrt(tmp * 2.f * toWp.z());
|
||||
tmp = 1.f / (tmp2 / tmp);
|
||||
xc_launchVel = zeus::CVector3f(tmp * toWp.x, tmp * toWp.y, tmp2);
|
||||
xc_launchVel = zeus::CVector3f(tmp * toWp.x(), tmp * toWp.y(), tmp2);
|
||||
x18_24_launched = false;
|
||||
}
|
||||
}
|
||||
|
@ -1842,7 +1839,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
|
|||
if (TCastToPtr<CActor> wp = mgr.ObjectById(x8_wpId))
|
||||
{
|
||||
xc_launchVel = 15.f * wp->GetTransform().basis[1];
|
||||
xc_launchVel.z = 5.f;
|
||||
xc_launchVel.z() = 5.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2005,13 +2002,13 @@ float CBSLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc)
|
|||
if (IsPitchable())
|
||||
{
|
||||
zeus::CVector3f tmp = vec;
|
||||
tmp.z = 0.f;
|
||||
tmp.z() = 0.f;
|
||||
zeus::CVector3f lookVec = act->GetTransform().basis[1];
|
||||
lookVec.z = 0.f;
|
||||
lookVec.z() = 0.f;
|
||||
lookVec.normalize();
|
||||
bc.FaceDirection3D(tmp, lookVec, dt);
|
||||
zeus::CVector3f lookVec2 = act->GetTransform().basis[1];
|
||||
lookVec2.z = vec.z;
|
||||
lookVec2.z() = float(vec.z());
|
||||
lookVec2.normalize();
|
||||
if (!zeus::close_enough(lookVec, lookVec2, 0.0001f))
|
||||
{
|
||||
|
@ -2021,7 +2018,7 @@ float CBSLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc)
|
|||
}
|
||||
bc.FaceDirection3D(lookVec2, act->GetTransform().basis[1], dt);
|
||||
zeus::CVector3f lookVec3 = act->GetTransform().basis[1];
|
||||
lookVec3.z = 0.f;
|
||||
lookVec3.z() = 0.f;
|
||||
bc.FaceDirection3D(lookVec3, act->GetTransform().basis[1], dt);
|
||||
}
|
||||
else
|
||||
|
@ -2283,11 +2280,11 @@ float CBSFlyerLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc)
|
|||
float ret = CBSLocomotion::ApplyLocomotionPhysics(dt, bc);
|
||||
if (TCastToPtr<CPhysicsActor> act = bc.GetOwner())
|
||||
{
|
||||
if (std::fabs(bc.GetCommandMgr().GetMoveVector().z) > 0.01f &&
|
||||
if (std::fabs(bc.GetCommandMgr().GetMoveVector().z()) > 0.01f &&
|
||||
(!x3cc_pitchable || bc.GetBodyStateInfo().GetMaximumPitch() < 0.17453292f))
|
||||
{
|
||||
zeus::CVector3f dir;
|
||||
dir.z = dt * bc.GetBodyStateInfo().GetMaxSpeed() * bc.GetCommandMgr().GetMoveVector().z;
|
||||
dir.z() = dt * bc.GetBodyStateInfo().GetMaxSpeed() * bc.GetCommandMgr().GetMoveVector().z();
|
||||
act->ApplyImpulseWR(act->GetMoveToORImpulseWR(dir, dt), zeus::CAxisAngle::sIdentity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ void CGroundMovement::CheckFalling(CPhysicsActor& actor, CStateManager& mgr, flo
|
|||
mgr.SendScriptMsg(&actor, kInvalidUniqueId, EScriptObjectMessage::OnFloor);
|
||||
actor.SetAngularVelocityWR(actor.GetAngularVelocityWR() * 0.98f);
|
||||
zeus::CVector3f vel = actor.GetTransform().transposeRotate(actor.GetVelocity());
|
||||
vel.z = 0.f;
|
||||
vel.z() = 0.f;
|
||||
actor.SetVelocityOR(vel);
|
||||
actor.SetMomentumWR(zeus::CVector3f::skZero);
|
||||
}
|
||||
|
@ -166,15 +166,15 @@ bool CGroundMovement::ResolveUpDown(CAreaCollisionCache& cache, CStateManager& m
|
|||
return true;
|
||||
|
||||
zeus::CAABox actorAABB = actor.GetBoundingBox();
|
||||
if (normAccum.z >= 0.f)
|
||||
if (normAccum.z() >= 0.f)
|
||||
{
|
||||
zextent = aabb.max.z - actorAABB.min.z + 0.02f;
|
||||
zextent = aabb.max.z() - actorAABB.min.z() + 0.02f;
|
||||
if (zextent > stepUp)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
zextent = aabb.min.z - actorAABB.max.z - 0.02f;
|
||||
zextent = aabb.min.z() - actorAABB.max.z() - 0.02f;
|
||||
if (zextent < -stepDown)
|
||||
return true;
|
||||
}
|
||||
|
@ -226,9 +226,9 @@ bool CGroundMovement::MoveGroundColliderZ(CAreaCollisionCache& cache, CStateMana
|
|||
zeus::CAABox actorAABB = actor.GetBoundingBox();
|
||||
float zextent;
|
||||
if (amt > 0.f)
|
||||
zextent = aabb.min.z - actorAABB.max.z - 0.02f + amt;
|
||||
zextent = aabb.min.z() - actorAABB.max.z() - 0.02f + amt;
|
||||
else
|
||||
zextent = aabb.max.z - actorAABB.min.z + 0.02f + amt;
|
||||
zextent = aabb.max.z() - actorAABB.min.z() + 0.02f + amt;
|
||||
|
||||
actor.MoveCollisionPrimitive({0.f, 0.f, zextent});
|
||||
|
||||
|
@ -426,11 +426,11 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
|
|||
if (noJump)
|
||||
{
|
||||
zeus::CVector3f vel = player.GetVelocity();
|
||||
vel.z = 0.f;
|
||||
vel.z() = 0.f;
|
||||
actor.SetVelocityWR(vel);
|
||||
actor.x15c_force.z = 0.f;
|
||||
actor.x150_momentum.z = 0.f;
|
||||
actor.x168_impulse.z = 0.f;
|
||||
actor.x15c_force.z() = 0.f;
|
||||
actor.x150_momentum.z() = 0.f;
|
||||
actor.x168_impulse.z() = 0.f;
|
||||
}
|
||||
|
||||
CPhysicsState physStatePre = actor.GetPhysicsState();
|
||||
|
@ -688,9 +688,9 @@ bool CGroundMovement::RemoveNormalComponent(const zeus::CVector3f& a, zeus::CVec
|
|||
|
||||
static bool RemovePositiveZComponentFromNormal(zeus::CVector3f& vec)
|
||||
{
|
||||
if (vec.z > 0.f && vec.z < 0.99f)
|
||||
if (vec.z() > 0.f && vec.z() < 0.99f)
|
||||
{
|
||||
vec.z = 0.f;
|
||||
vec.z() = 0.f;
|
||||
vec.normalize();
|
||||
return true;
|
||||
}
|
||||
|
@ -795,9 +795,9 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics
|
|||
vel += (elasticForce - dot) * collisionNorm;
|
||||
if (clipCollision && floorCollision)
|
||||
if (!CGroundMovement::RemoveNormalComponent(floorPlaneNormal, vel))
|
||||
vel.z = 0.f;
|
||||
if (vel.z > opts.x38_maxPositiveVerticalVelocity)
|
||||
vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z);
|
||||
vel.z() = 0.f;
|
||||
if (vel.z() > opts.x38_maxPositiveVerticalVelocity)
|
||||
vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z());
|
||||
|
||||
if (opts.x18_dampForceAndMomentum)
|
||||
{
|
||||
|
@ -818,11 +818,11 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics
|
|||
|
||||
if (opts.x0_setWaterLandingForce && !floor)
|
||||
{
|
||||
if (collisionInfo.GetNormalLeft().z < -0.1f && vel.z > 0.f)
|
||||
vel.z *= 0.5f;
|
||||
if (collisionInfo.GetNormalLeft().z() < -0.1f && vel.z() > 0.f)
|
||||
vel.z() *= 0.5f;
|
||||
|
||||
float zNormAbs = std::fabs(collisionInfo.GetNormalLeft().z);
|
||||
if ((zNormAbs > opts.x10_downwardZThreshold && vel.z < 0.f) || zNormAbs > opts.xc_anyZThreshold)
|
||||
float zNormAbs = std::fabs(collisionInfo.GetNormalLeft().z());
|
||||
if ((zNormAbs > opts.x10_downwardZThreshold && vel.z() < 0.f) || zNormAbs > opts.xc_anyZThreshold)
|
||||
{
|
||||
actor.x15c_force = zeus::CVector3f(0.f, 0.f,
|
||||
-(1.f + std::max(opts.x4_waterLandingForceCoefficient * zNormAbs,
|
||||
|
@ -836,8 +836,8 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics
|
|||
else
|
||||
{
|
||||
zeus::CVector3f vel = actor.x138_velocity;
|
||||
if (actor.x138_velocity.z > opts.x38_maxPositiveVerticalVelocity)
|
||||
vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z);
|
||||
if (actor.x138_velocity.z() > opts.x38_maxPositiveVerticalVelocity)
|
||||
vel *= zeus::CVector3f(opts.x38_maxPositiveVerticalVelocity / vel.z());
|
||||
|
||||
actor.SetVelocityWR(vel);
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf,
|
|||
{
|
||||
if (x14_25_sortThermal && which == EWhichModel::ThermalHot)
|
||||
{
|
||||
zeus::CColor mul(drawFlags.x4_color.a, drawFlags.x4_color.a);
|
||||
zeus::CColor mul(drawFlags.x4_color.a(), drawFlags.x4_color.a());
|
||||
RenderThermal(xf, mul, {0.f, 0.f, 0.f, 0.25f}, drawFlags);
|
||||
}
|
||||
else
|
||||
|
@ -500,7 +500,7 @@ void CModelData::DisintegrateDraw(EWhichModel which, const zeus::CTransform& xf,
|
|||
CModelFlags flags(5, 0, 3, zeus::CColor::skWhite);
|
||||
flags.m_extendedShader = EExtendedShader::Disintegrate;
|
||||
flags.addColor = addColor;
|
||||
flags.addColor.a = t; // Stash T value in here (shader does not care)
|
||||
flags.addColor.a() = t; // Stash T value in here (shader does not care)
|
||||
|
||||
if (x10_animData)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ void CRagDoll::AccumulateForces(float dt, float waterTop)
|
|||
float volume = particle.x10_radius * particle.x10_radius * particle.x10_radius;
|
||||
totalVolume += volume;
|
||||
centerOfVolume += particle.x4_curPos * volume;
|
||||
float fromTargetZ = particle.x4_curPos.z - targetZ;
|
||||
float fromTargetZ = particle.x4_curPos.z() - targetZ;
|
||||
float verticalAcc = x48_floatingGravity;
|
||||
float termVelCoefficient = 0.f;
|
||||
if (std::fabs(fromTargetZ) < 0.5f)
|
||||
|
@ -100,7 +100,7 @@ void CRagDoll::AccumulateForces(float dt, float waterTop)
|
|||
verticalAcc = x44_normalGravity;
|
||||
termVelCoefficient = 1.f;
|
||||
}
|
||||
particle.x20_velocity.z += verticalAcc;
|
||||
particle.x20_velocity.z() += verticalAcc;
|
||||
zeus::CVector3f vel = (particle.x4_curPos - particle.x14_prevPos) * fps;
|
||||
float velMag = vel.magnitude();
|
||||
if (velMag > FLT_EPSILON)
|
||||
|
|
|
@ -136,6 +136,8 @@ public:
|
|||
bool IsPrimed() const { return x68_26_primed; }
|
||||
bool WillContinueSmallMovements() const { return x68_27_continueSmallMovements; }
|
||||
bool IsOver() const { return x68_25_over; }
|
||||
void SetNoOverTimer(bool b) { x68_28_noOverTimer = b; }
|
||||
void SetContinueSmallMovements(bool b) { x68_27_continueSmallMovements = b; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ CSteeringBehaviors::ProjectOrbitalPosition(const zeus::CVector3f& pos, const zeu
|
|||
if (vel.canBeNormalized())
|
||||
{
|
||||
zeus::CVector3f pointToPos = pos - orbitPoint;
|
||||
pointToPos.z = 0.f;
|
||||
pointToPos.z() = 0.f;
|
||||
if (pointToPos.canBeNormalized())
|
||||
{
|
||||
zeus::CVector3f useVel = vel;
|
||||
|
@ -416,7 +416,7 @@ CSteeringBehaviors::ProjectOrbitalPosition(const zeus::CVector3f& pos, const zeu
|
|||
{
|
||||
usePos += preThinkDt * useVel;
|
||||
zeus::CVector3f usePointToPos = usePos - orbitPoint;
|
||||
usePointToPos.z = 0.f;
|
||||
usePointToPos.z() = 0.f;
|
||||
if (usePointToPos.canBeNormalized())
|
||||
{
|
||||
usePointToPos.normalize();
|
||||
|
|
|
@ -14,15 +14,15 @@ void CAABoxFilter::FilterBoxFloorCollisions(const CCollisionInfoList& in, CColli
|
|||
float minZ = 10000.f;
|
||||
for (const CCollisionInfo& info : in)
|
||||
{
|
||||
if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Wall) && info.GetPoint().z < minZ)
|
||||
minZ = info.GetPoint().z;
|
||||
if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Wall) && info.GetPoint().z() < minZ)
|
||||
minZ = info.GetPoint().z();
|
||||
}
|
||||
CCollisionInfoList temp;
|
||||
for (const CCollisionInfo& info : in)
|
||||
{
|
||||
if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Floor))
|
||||
{
|
||||
if (info.GetPoint().z < minZ)
|
||||
if (info.GetPoint().z() < minZ)
|
||||
temp.Add(info, false);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -13,10 +13,14 @@ static bool _close_enough(float f1, float f2, float epsilon)
|
|||
|
||||
static bool BoxLineTest(const zeus::CAABox& aabb, const zeus::CLine& line, float& lT, float& hT)
|
||||
{
|
||||
const float* aabbMin = &aabb.min.x;
|
||||
const float* aabbMax = &aabb.max.x;
|
||||
const float* lorigin = &line.origin.x;
|
||||
const float* ldir = &line.dir.x;
|
||||
zeus::simd_floats aabbMinF(aabb.min.mSimd);
|
||||
zeus::simd_floats aabbMaxF(aabb.max.mSimd);
|
||||
zeus::simd_floats lineOrigin(line.origin.mSimd);
|
||||
zeus::simd_floats lineDir(line.dir.mSimd);
|
||||
const float* aabbMin = aabbMinF.data();
|
||||
const float* aabbMax = aabbMaxF.data();
|
||||
const float* lorigin = lineOrigin.data();
|
||||
const float* ldir = lineDir.data();
|
||||
lT = -FLT_MAX;
|
||||
hT = FLT_MAX;
|
||||
|
||||
|
@ -416,11 +420,11 @@ void CAreaOctTree::Node::LineTestExInternal(const zeus::CLine& line, const CMate
|
|||
|
||||
zeus::CVector3f lineStart = line.origin + (lT * line.dir);
|
||||
int selector = 0;
|
||||
if (lineStart.x >= center.x)
|
||||
if (lineStart.x() >= center.x())
|
||||
selector = 1;
|
||||
if (lineStart.y >= center.y)
|
||||
if (lineStart.y() >= center.y())
|
||||
selector |= 1 << 1;
|
||||
if (lineStart.z >= center.z)
|
||||
if (lineStart.z() >= center.z())
|
||||
selector |= 1 << 2;
|
||||
|
||||
float tmpLoT = lT;
|
||||
|
|
|
@ -162,7 +162,7 @@ CRayCastResult CCollidableOBBTree::LineIntersectsTree(const zeus::CMRay& ray, co
|
|||
zeus::CPlane CCollidableOBBTree::TransformPlane(const zeus::CPlane& pl, const zeus::CTransform& xf)
|
||||
{
|
||||
zeus::CVector3f normal = xf.rotate(pl.normal());
|
||||
return zeus::CPlane(normal, (xf * (pl.normal() * pl.d)).dot(normal));
|
||||
return zeus::CPlane(normal, (xf * (pl.normal() * pl.d())).dot(normal));
|
||||
}
|
||||
|
||||
bool CCollidableOBBTree::SphereCollideWithLeafMoving(const COBBTree::CLeafData& leaf, const zeus::CTransform& xf,
|
||||
|
|
|
@ -68,82 +68,82 @@ bool Sphere_AABox(const CInternalCollisionStructure& collision, CCollisionInfoLi
|
|||
switch (flags)
|
||||
{
|
||||
case 0x1a:
|
||||
point = zeus::CVector3f(b1.max.x, b1.max.y, b1.min.z);
|
||||
point = zeus::CVector3f(b1.max.x(), b1.max.y(), b1.min.z());
|
||||
break;
|
||||
case 0x19:
|
||||
point = zeus::CVector3f(b1.min.x, b1.max.y, b1.min.z);
|
||||
point = zeus::CVector3f(b1.min.x(), b1.max.y(), b1.min.z());
|
||||
break;
|
||||
case 0x16:
|
||||
point = zeus::CVector3f(b1.max.x, b1.min.y, b1.min.z);
|
||||
point = zeus::CVector3f(b1.max.x(), b1.min.y(), b1.min.z());
|
||||
break;
|
||||
case 0x15:
|
||||
point = zeus::CVector3f(b1.min.x, b1.min.y, b1.min.z);
|
||||
point = zeus::CVector3f(b1.min.x(), b1.min.y(), b1.min.z());
|
||||
break;
|
||||
case 0x2a:
|
||||
point = zeus::CVector3f(b1.max.x, b1.max.y, b1.max.z);
|
||||
point = zeus::CVector3f(b1.max.x(), b1.max.y(), b1.max.z());
|
||||
break;
|
||||
case 0x29:
|
||||
point = zeus::CVector3f(b1.min.x, b1.max.y, b1.max.z);
|
||||
point = zeus::CVector3f(b1.min.x(), b1.max.y(), b1.max.z());
|
||||
break;
|
||||
case 0x26:
|
||||
point = zeus::CVector3f(b1.max.x, b1.min.y, b1.max.z);
|
||||
point = zeus::CVector3f(b1.max.x(), b1.min.y(), b1.max.z());
|
||||
break;
|
||||
case 0x25:
|
||||
point = zeus::CVector3f(b1.min.x, b1.min.y, b1.max.z);
|
||||
point = zeus::CVector3f(b1.min.x(), b1.min.y(), b1.max.z());
|
||||
break;
|
||||
case 0x11:
|
||||
point = zeus::CVector3f(b1.min.x, s0.position.y, b1.min.z);
|
||||
point = zeus::CVector3f(b1.min.x(), s0.position.y(), b1.min.z());
|
||||
break;
|
||||
case 0x12:
|
||||
point = zeus::CVector3f(b1.max.x, s0.position.y, b1.min.z);
|
||||
point = zeus::CVector3f(b1.max.x(), s0.position.y(), b1.min.z());
|
||||
break;
|
||||
case 0x14:
|
||||
point = zeus::CVector3f(s0.position.x, b1.min.y, b1.min.z);
|
||||
point = zeus::CVector3f(s0.position.x(), b1.min.y(), b1.min.z());
|
||||
break;
|
||||
case 0x18:
|
||||
point = zeus::CVector3f(s0.position.x, b1.max.y, b1.min.z);
|
||||
point = zeus::CVector3f(s0.position.x(), b1.max.y(), b1.min.z());
|
||||
break;
|
||||
case 0x5:
|
||||
point = zeus::CVector3f(b1.min.x, b1.min.y, s0.position.z);
|
||||
point = zeus::CVector3f(b1.min.x(), b1.min.y(), s0.position.z());
|
||||
break;
|
||||
case 0x6:
|
||||
point = zeus::CVector3f(b1.max.x, b1.min.y, s0.position.z);
|
||||
point = zeus::CVector3f(b1.max.x(), b1.min.y(), s0.position.z());
|
||||
break;
|
||||
case 0x9:
|
||||
point = zeus::CVector3f(b1.min.x, b1.max.y, s0.position.z);
|
||||
point = zeus::CVector3f(b1.min.x(), b1.max.y(), s0.position.z());
|
||||
break;
|
||||
case 0xa:
|
||||
point = zeus::CVector3f(b1.max.x, b1.max.y, s0.position.z);
|
||||
point = zeus::CVector3f(b1.max.x(), b1.max.y(), s0.position.z());
|
||||
break;
|
||||
case 0x21:
|
||||
point = zeus::CVector3f(b1.min.x, s0.position.y, b1.max.z);
|
||||
point = zeus::CVector3f(b1.min.x(), s0.position.y(), b1.max.z());
|
||||
break;
|
||||
case 0x22:
|
||||
point = zeus::CVector3f(b1.max.x, s0.position.y, b1.max.z);
|
||||
point = zeus::CVector3f(b1.max.x(), s0.position.y(), b1.max.z());
|
||||
break;
|
||||
case 0x24:
|
||||
point = zeus::CVector3f(s0.position.x, b1.min.y, b1.max.z);
|
||||
point = zeus::CVector3f(s0.position.x(), b1.min.y(), b1.max.z());
|
||||
break;
|
||||
case 0x28:
|
||||
point = zeus::CVector3f(s0.position.x, b1.max.y, b1.max.z);
|
||||
point = zeus::CVector3f(s0.position.x(), b1.max.y(), b1.max.z());
|
||||
break;
|
||||
case 0x1:
|
||||
point = zeus::CVector3f(b1.min.x, s0.position.y, s0.position.z);
|
||||
point = zeus::CVector3f(b1.min.x(), s0.position.y(), s0.position.z());
|
||||
break;
|
||||
case 0x2:
|
||||
point = zeus::CVector3f(b1.max.x, s0.position.y, s0.position.z);
|
||||
point = zeus::CVector3f(b1.max.x(), s0.position.y(), s0.position.z());
|
||||
break;
|
||||
case 0x4:
|
||||
point = zeus::CVector3f(s0.position.x, b1.min.y, s0.position.z);
|
||||
point = zeus::CVector3f(s0.position.x(), b1.min.y(), s0.position.z());
|
||||
break;
|
||||
case 0x8:
|
||||
point = zeus::CVector3f(s0.position.x, b1.max.y, s0.position.z);
|
||||
point = zeus::CVector3f(s0.position.x(), b1.max.y(), s0.position.z());
|
||||
break;
|
||||
case 0x10:
|
||||
point = zeus::CVector3f(s0.position.x, s0.position.y, b1.min.z);
|
||||
point = zeus::CVector3f(s0.position.x(), s0.position.y(), b1.min.z());
|
||||
break;
|
||||
case 0x20:
|
||||
point = zeus::CVector3f(s0.position.x, s0.position.y, b1.max.z);
|
||||
point = zeus::CVector3f(s0.position.x(), s0.position.y(), b1.max.z());
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
|
|
@ -113,8 +113,8 @@ zeus::CVector3f CCollisionActor::GetScanObjectIndicatorPosition(const CStateMana
|
|||
else
|
||||
{
|
||||
const zeus::CVector3f v = GetBoxSize();
|
||||
float comp = (v.x < v.y ? v.y : v.z);
|
||||
comp = (comp < v.z ? v.x : comp);
|
||||
float comp = (v.x() < v.y() ? v.y() : v.z());
|
||||
comp = (comp < v.z() ? v.x() : comp);
|
||||
|
||||
scanScale = 0.5f * comp;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
|
|||
if (dist <= FLT_EPSILON)
|
||||
continue;
|
||||
zeus::CVector3f bounds = modDesc.GetBounds();
|
||||
bounds.y += dist;
|
||||
bounds.y() += dist;
|
||||
CCollisionActor* newAct =
|
||||
new CCollisionActor(mgr.AllocateUniqueId(), area, x10_ownerId, bounds,
|
||||
zeus::CVector3f(0.f, 0.5f * dist, 0.f), active, modDesc.GetMass());
|
||||
|
|
|
@ -32,9 +32,9 @@ public:
|
|||
CCollisionInfo(const zeus::CAABox& aabox, const CMaterialList& list1, const CMaterialList& list2,
|
||||
const zeus::CVector3f& normalLeft, const zeus::CVector3f& normalRight)
|
||||
: x0_point(aabox.min),
|
||||
xc_extentX(aabox.max.x - aabox.min.x, 0.f, 0.f),
|
||||
x18_extentY(0.f, aabox.max.y - aabox.min.y, 0.f),
|
||||
x24_extentZ(0.f, 0.f, aabox.max.z - aabox.min.z),
|
||||
xc_extentX(aabox.max.x() - aabox.min.x(), 0.f, 0.f),
|
||||
x18_extentY(0.f, aabox.max.y() - aabox.min.y(), 0.f),
|
||||
x24_extentZ(0.f, 0.f, aabox.max.z() - aabox.min.z()),
|
||||
x30_valid(true), x31_hasExtents(true), x38_materialLeft(list2),
|
||||
x40_materialRight(list1), x48_normalLeft(normalLeft),
|
||||
x54_normalRight(normalRight)
|
||||
|
|
|
@ -246,14 +246,14 @@ bool CGameCollision::CanBlock(const CMaterialList& mat, const zeus::CVector3f& v
|
|||
if (mat.HasMaterial(EMaterialTypes::Floor))
|
||||
return true;
|
||||
|
||||
return (v.z > 0.85f);
|
||||
return (v.z() > 0.85f);
|
||||
}
|
||||
|
||||
bool CGameCollision::IsFloor(const CMaterialList& mat, const zeus::CVector3f& v)
|
||||
{
|
||||
if (mat.HasMaterial(EMaterialTypes::Floor))
|
||||
return true;
|
||||
return (v.z > 0.85f);
|
||||
return (v.z() > 0.85f);
|
||||
}
|
||||
|
||||
void CGameCollision::SendMaterialMessage(CStateManager& mgr, const CMaterialList& mat, CActor& act)
|
||||
|
@ -424,9 +424,9 @@ float CGameCollision::GetMinExtentForCollisionPrimitive(const CCollisionPrimitiv
|
|||
else if (prim.GetPrimType() == FOURCC('AABX'))
|
||||
{
|
||||
const CCollidableAABox& aabx = static_cast<const CCollidableAABox&>(prim);
|
||||
zeus::CVector3f extent = aabx.GetAABB().max - aabx.GetAABB().min;
|
||||
float minExtent = std::min(extent.x, extent.y);
|
||||
minExtent = std::min(minExtent, extent.z);
|
||||
const zeus::CVector3f extent = aabx.GetAABB().max - aabx.GetAABB().min;
|
||||
float minExtent = std::min(extent.x(), extent.y());
|
||||
minExtent = std::min(minExtent, extent.z());
|
||||
return minExtent;
|
||||
}
|
||||
else if (prim.GetPrimType() == FOURCC('ABSH'))
|
||||
|
@ -882,7 +882,7 @@ void CGameCollision::CollideWithDynamicBodyNoRot(CPhysicsActor& a0, CPhysicsActo
|
|||
{
|
||||
zeus::CVector3f normal = info.GetNormalLeft();
|
||||
if (zeroZ)
|
||||
normal.z = 0.f;
|
||||
normal.z() = 0.f;
|
||||
|
||||
zeus::CVector3f relVel = GetActorRelativeVelocities(a0, &a1);
|
||||
float velNormDot = relVel.dot(normal);
|
||||
|
@ -952,7 +952,7 @@ void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMateri
|
|||
{
|
||||
zeus::CUnitVector3f useNorm = normal;
|
||||
if (zeroZ && m0.HasMaterial(EMaterialTypes::Player) && !m1.HasMaterial(EMaterialTypes::Floor))
|
||||
useNorm.z = 0.f;
|
||||
useNorm.z() = 0.f;
|
||||
|
||||
if (useNorm.canBeNormalized())
|
||||
{
|
||||
|
|
|
@ -63,8 +63,8 @@ CJointCollisionDescription::OBBCollision(CSegId pivotId, const zeus::CVector3f&
|
|||
void CJointCollisionDescription::ScaleAllBounds(const zeus::CVector3f& scale)
|
||||
{
|
||||
xc_bounds *= scale;
|
||||
x24_radius *= scale.x;
|
||||
x28_maxSeparation *= scale.x;
|
||||
x24_radius *= scale.x();
|
||||
x28_maxSeparation *= scale.x();
|
||||
x18_pivotPoint *= scale;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ void CMetroidAreaCollider::BuildOctreeLeafCache(const CAreaOctTree::Node& node,
|
|||
static zeus::CVector3f ClipRayToPlane(const zeus::CVector3f& a, const zeus::CVector3f& b,
|
||||
const zeus::CPlane& plane)
|
||||
{
|
||||
return (1.f - -plane.pointToPlaneDist(a) / (b - a).dot(plane.vec)) * (a - b) + b;
|
||||
return (1.f - -plane.pointToPlaneDist(a) / (b - a).dot(plane.normal())) * (a - b) + b;
|
||||
}
|
||||
|
||||
bool CMetroidAreaCollider::ConvexPolyCollision(const zeus::CPlane* planes, const zeus::CVector3f* verts,
|
||||
|
@ -722,8 +722,8 @@ bool CMetroidAreaCollider::MovingAABoxCollisionCheck_Edge(const zeus::CVector3f&
|
|||
|
||||
zeus::CVector3d clipped = ev0d + (-(ev0d.dot(edge.x70_coDir) - edge.x88_dirCoDirDot) /
|
||||
delta.dot(edge.x70_coDir)) * delta;
|
||||
int maxCompIdx = (std::fabs(edge.x70_coDir.x) > std::fabs(edge.x70_coDir.y)) ? 0 : 1;
|
||||
if (std::fabs(edge.x70_coDir[maxCompIdx]) < std::fabs(edge.x70_coDir.z))
|
||||
int maxCompIdx = (std::fabs(edge.x70_coDir.x()) > std::fabs(edge.x70_coDir.y())) ? 0 : 1;
|
||||
if (std::fabs(edge.x70_coDir[maxCompIdx]) < std::fabs(edge.x70_coDir.z()))
|
||||
maxCompIdx = 2;
|
||||
|
||||
int ci0, ci1;
|
||||
|
|
|
@ -20,8 +20,7 @@ void CRayCastResult::MakeInvalid()
|
|||
void CRayCastResult::Transform(const zeus::CTransform& xf)
|
||||
{
|
||||
x4_point = xf * x4_point;
|
||||
x10_plane.vec = xf.rotate(x10_plane.vec);
|
||||
x10_plane.d = x10_plane.vec.dot(x4_point);
|
||||
x10_plane = zeus::CPlane(xf.rotate(x10_plane.normal()), x10_plane.normal().dot(x4_point));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& aabb,
|
|||
zeus::CVector3f vec0 = {-1.f, -1.f, -1.f};
|
||||
zeus::CVector3f vec1;
|
||||
|
||||
if (rayDelta.x != 0.f && rayDelta.y != 0.f && rayDelta.z != 0.f)
|
||||
if (rayDelta.x() != 0.f && rayDelta.y() != 0.f && rayDelta.z() != 0.f)
|
||||
{
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
|
@ -97,13 +97,13 @@ u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& aabb,
|
|||
{
|
||||
sign[i] = 1;
|
||||
bad = false;
|
||||
end[i] = aabbMin[i];
|
||||
end[i] = float(aabbMin[i]);
|
||||
}
|
||||
else if (rayStart[i] > aabbMax[i])
|
||||
{
|
||||
sign[i] = 0;
|
||||
bad = false;
|
||||
end[i] = aabbMax[i];
|
||||
end[i] = float(aabbMax[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,16 +118,16 @@ u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& aabb,
|
|||
vec0[i] = (end[i] - rayStart[i]) / rayDelta[i];
|
||||
}
|
||||
|
||||
float maxComp = vec0.x;
|
||||
float maxComp = vec0.x();
|
||||
int maxCompIdx = 0;
|
||||
if (maxComp < vec0.y)
|
||||
if (maxComp < vec0.y())
|
||||
{
|
||||
maxComp = vec0.y;
|
||||
maxComp = vec0.y();
|
||||
maxCompIdx = 1;
|
||||
}
|
||||
if (maxComp < vec0.z)
|
||||
if (maxComp < vec0.z())
|
||||
{
|
||||
maxComp = vec0.z;
|
||||
maxComp = vec0.z();
|
||||
maxCompIdx = 2;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ u32 RayAABoxIntersection_Double(const zeus::CMRay& ray, const zeus::CAABox& aabb
|
|||
zeus::CVector3d vec0 = {-1.0, -1.0, -1.0};
|
||||
zeus::CVector3d vec1;
|
||||
|
||||
if (rayDelta.x != 0.0 && rayDelta.y != 0.0 && rayDelta.z != 0.0)
|
||||
if (rayDelta.x() != 0.0 && rayDelta.y() != 0.0 && rayDelta.z() != 0.0)
|
||||
{
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
|
@ -196,13 +196,13 @@ u32 RayAABoxIntersection_Double(const zeus::CMRay& ray, const zeus::CAABox& aabb
|
|||
{
|
||||
sign[i] = 1;
|
||||
bad = false;
|
||||
end[i] = aabbMin[i];
|
||||
end[i] = double(aabbMin[i]);
|
||||
}
|
||||
else if (rayStart[i] > aabbMax[i])
|
||||
{
|
||||
sign[i] = 0;
|
||||
bad = false;
|
||||
end[i] = aabbMax[i];
|
||||
end[i] = double(aabbMax[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,16 +217,16 @@ u32 RayAABoxIntersection_Double(const zeus::CMRay& ray, const zeus::CAABox& aabb
|
|||
vec0[i] = (end[i] - rayStart[i]) / rayDelta[i];
|
||||
}
|
||||
|
||||
double maxComp = vec0.x;
|
||||
double maxComp = vec0.x();
|
||||
int maxCompIdx = 0;
|
||||
if (maxComp < vec0.y)
|
||||
if (maxComp < vec0.y())
|
||||
{
|
||||
maxComp = vec0.y;
|
||||
maxComp = vec0.y();
|
||||
maxCompIdx = 1;
|
||||
}
|
||||
if (maxComp < vec0.z)
|
||||
if (maxComp < vec0.z())
|
||||
{
|
||||
maxComp = vec0.z;
|
||||
maxComp = vec0.z();
|
||||
maxCompIdx = 2;
|
||||
}
|
||||
|
||||
|
@ -389,32 +389,32 @@ bool AABoxAABoxIntersection(const zeus::CAABox& aabb0, const CMaterialList& list
|
|||
const zeus::CAABox& aabb1, const CMaterialList& list1,
|
||||
CCollisionInfoList& infoList)
|
||||
{
|
||||
zeus::CVector3f maxOfMin(std::max(aabb0.min.x, aabb1.min.x),
|
||||
std::max(aabb0.min.y, aabb1.min.y),
|
||||
std::max(aabb0.min.z, aabb1.min.z));
|
||||
zeus::CVector3f minOfMax(std::min(aabb0.max.x, aabb1.max.x),
|
||||
std::min(aabb0.max.y, aabb1.max.y),
|
||||
std::min(aabb0.max.z, aabb1.max.z));
|
||||
zeus::CVector3f maxOfMin(std::max(aabb0.min.x(), aabb1.min.x()),
|
||||
std::max(aabb0.min.y(), aabb1.min.y()),
|
||||
std::max(aabb0.min.z(), aabb1.min.z()));
|
||||
zeus::CVector3f minOfMax(std::min(aabb0.max.x(), aabb1.max.x()),
|
||||
std::min(aabb0.max.y(), aabb1.max.y()),
|
||||
std::min(aabb0.max.z(), aabb1.max.z()));
|
||||
|
||||
if (maxOfMin.x >= minOfMax.x || maxOfMin.y >= minOfMax.y || maxOfMin.z >= minOfMax.z)
|
||||
if (maxOfMin.x() >= minOfMax.x() || maxOfMin.y() >= minOfMax.y() || maxOfMin.z() >= minOfMax.z())
|
||||
return false;
|
||||
|
||||
zeus::CAABox boolAABB(maxOfMin, minOfMax);
|
||||
|
||||
int ineqFlags[] =
|
||||
{
|
||||
(aabb0.min.x <= aabb1.min.x ? 1 << 0 : 0) |
|
||||
(aabb0.min.x <= aabb1.max.x ? 1 << 1 : 0) |
|
||||
(aabb0.max.x <= aabb1.min.x ? 1 << 2 : 0) |
|
||||
(aabb0.max.x <= aabb1.max.x ? 1 << 3 : 0),
|
||||
(aabb0.min.y <= aabb1.min.y ? 1 << 0 : 0) |
|
||||
(aabb0.min.y <= aabb1.max.y ? 1 << 1 : 0) |
|
||||
(aabb0.max.y <= aabb1.min.y ? 1 << 2 : 0) |
|
||||
(aabb0.max.y <= aabb1.max.y ? 1 << 3 : 0),
|
||||
(aabb0.min.z <= aabb1.min.z ? 1 << 0 : 0) |
|
||||
(aabb0.min.z <= aabb1.max.z ? 1 << 1 : 0) |
|
||||
(aabb0.max.z <= aabb1.min.z ? 1 << 2 : 0) |
|
||||
(aabb0.max.z <= aabb1.max.z ? 1 << 3 : 0),
|
||||
(aabb0.min.x() <= aabb1.min.x() ? 1 << 0 : 0) |
|
||||
(aabb0.min.x() <= aabb1.max.x() ? 1 << 1 : 0) |
|
||||
(aabb0.max.x() <= aabb1.min.x() ? 1 << 2 : 0) |
|
||||
(aabb0.max.x() <= aabb1.max.x() ? 1 << 3 : 0),
|
||||
(aabb0.min.y() <= aabb1.min.y() ? 1 << 0 : 0) |
|
||||
(aabb0.min.y() <= aabb1.max.y() ? 1 << 1 : 0) |
|
||||
(aabb0.max.y() <= aabb1.min.y() ? 1 << 2 : 0) |
|
||||
(aabb0.max.y() <= aabb1.max.y() ? 1 << 3 : 0),
|
||||
(aabb0.min.z() <= aabb1.min.z() ? 1 << 0 : 0) |
|
||||
(aabb0.min.z() <= aabb1.max.z() ? 1 << 1 : 0) |
|
||||
(aabb0.max.z() <= aabb1.min.z() ? 1 << 2 : 0) |
|
||||
(aabb0.max.z() <= aabb1.max.z() ? 1 << 3 : 0),
|
||||
};
|
||||
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
|
@ -505,48 +505,48 @@ static bool planeBoxOverlap(const zeus::CVector3f& normal, float d, const zeus::
|
|||
|
||||
/*======================== X-tests ========================*/
|
||||
#define AXISTEST_X01(a, b, fa, fb) \
|
||||
p0 = a*v0.y - b*v0.z; \
|
||||
p2 = a*v2.y - b*v2.z; \
|
||||
p0 = a*v0.y() - b*v0.z(); \
|
||||
p2 = a*v2.y() - b*v2.z(); \
|
||||
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
|
||||
rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
|
||||
rad = fa * boxhalfsize.y() + fb * boxhalfsize.z(); \
|
||||
if(min>rad || max<-rad) return false;
|
||||
|
||||
#define AXISTEST_X2(a, b, fa, fb) \
|
||||
p0 = a*v0.y - b*v0.z; \
|
||||
p1 = a*v1.y - b*v1.z; \
|
||||
p0 = a*v0.y() - b*v0.z(); \
|
||||
p1 = a*v1.y() - b*v1.z(); \
|
||||
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
|
||||
rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
|
||||
rad = fa * boxhalfsize.y() + fb * boxhalfsize.z(); \
|
||||
if(min>rad || max<-rad) return false;
|
||||
|
||||
/*======================== Y-tests ========================*/
|
||||
#define AXISTEST_Y02(a, b, fa, fb) \
|
||||
p0 = -a*v0.x + b*v0.z; \
|
||||
p2 = -a*v2.x + b*v2.z; \
|
||||
p0 = -a*v0.x() + b*v0.z(); \
|
||||
p2 = -a*v2.x() + b*v2.z(); \
|
||||
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
|
||||
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
|
||||
rad = fa * boxhalfsize.x() + fb * boxhalfsize.z(); \
|
||||
if(min>rad || max<-rad) return false;
|
||||
|
||||
#define AXISTEST_Y1(a, b, fa, fb) \
|
||||
p0 = -a*v0.x + b*v0.z; \
|
||||
p1 = -a*v1.x + b*v1.z; \
|
||||
p0 = -a*v0.x() + b*v0.z(); \
|
||||
p1 = -a*v1.x() + b*v1.z(); \
|
||||
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
|
||||
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
|
||||
rad = fa * boxhalfsize.x() + fb * boxhalfsize.z(); \
|
||||
if(min>rad || max<-rad) return false;
|
||||
|
||||
/*======================== Z-tests ========================*/
|
||||
|
||||
#define AXISTEST_Z12(a, b, fa, fb) \
|
||||
p1 = a*v1.x - b*v1.y; \
|
||||
p2 = a*v2.x - b*v2.y; \
|
||||
p1 = a*v1.x() - b*v1.y(); \
|
||||
p2 = a*v2.x() - b*v2.y(); \
|
||||
if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;} \
|
||||
rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
|
||||
rad = fa * boxhalfsize.x() + fb * boxhalfsize.y(); \
|
||||
if(min>rad || max<-rad) return false;
|
||||
|
||||
#define AXISTEST_Z0(a, b, fa, fb) \
|
||||
p0 = a*v0.x - b*v0.y; \
|
||||
p1 = a*v1.x - b*v1.y; \
|
||||
p0 = a*v0.x() - b*v0.y(); \
|
||||
p1 = a*v1.x() - b*v1.y(); \
|
||||
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
|
||||
rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
|
||||
rad = fa * boxhalfsize.x() + fb * boxhalfsize.y(); \
|
||||
if(min>rad || max<-rad) return false;
|
||||
|
||||
bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxhalfsize,
|
||||
|
@ -578,26 +578,26 @@ bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxh
|
|||
|
||||
/* Bullet 3: */
|
||||
/* test the 9 tests first (this was faster) */
|
||||
fex = std::fabs(e0.x);
|
||||
fey = std::fabs(e0.y);
|
||||
fez = std::fabs(e0.z);
|
||||
AXISTEST_X01(e0.z, e0.y, fez, fey);
|
||||
AXISTEST_Y02(e0.z, e0.x, fez, fex);
|
||||
AXISTEST_Z12(e0.y, e0.x, fey, fex);
|
||||
fex = std::fabs(e0.x());
|
||||
fey = std::fabs(e0.y());
|
||||
fez = std::fabs(e0.z());
|
||||
AXISTEST_X01(e0.z(), e0.y(), fez, fey);
|
||||
AXISTEST_Y02(e0.z(), e0.x(), fez, fex);
|
||||
AXISTEST_Z12(e0.y(), e0.x(), fey, fex);
|
||||
|
||||
fex = std::fabs(e1.x);
|
||||
fey = std::fabs(e1.y);
|
||||
fez = std::fabs(e1.z);
|
||||
AXISTEST_X01(e1.z, e1.y, fez, fey);
|
||||
AXISTEST_Y02(e1.z, e1.x, fez, fex);
|
||||
AXISTEST_Z0(e1.y, e1.x, fey, fex);
|
||||
fex = std::fabs(e1.x());
|
||||
fey = std::fabs(e1.y());
|
||||
fez = std::fabs(e1.z());
|
||||
AXISTEST_X01(e1.z(), e1.y(), fez, fey);
|
||||
AXISTEST_Y02(e1.z(), e1.x(), fez, fex);
|
||||
AXISTEST_Z0(e1.y(), e1.x(), fey, fex);
|
||||
|
||||
fex = std::fabs(e2.x);
|
||||
fey = std::fabs(e2.y);
|
||||
fez = std::fabs(e2.z);
|
||||
AXISTEST_X2(e2.z, e2.y, fez, fey);
|
||||
AXISTEST_Y1(e2.z, e2.x, fez, fex);
|
||||
AXISTEST_Z12(e2.y, e2.x, fey, fex);
|
||||
fex = std::fabs(e2.x());
|
||||
fey = std::fabs(e2.y());
|
||||
fez = std::fabs(e2.z());
|
||||
AXISTEST_X2(e2.z(), e2.y(), fez, fey);
|
||||
AXISTEST_Y1(e2.z(), e2.x(), fez, fex);
|
||||
AXISTEST_Z12(e2.y(), e2.x(), fey, fex);
|
||||
|
||||
/* Bullet 1: */
|
||||
/* first test overlap in the {x,y,z}-directions */
|
||||
|
@ -606,16 +606,16 @@ bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxh
|
|||
/* the triangle against the AABB */
|
||||
|
||||
/* test in X-direction */
|
||||
FINDMINMAX(v0.x, v1.x, v2.x, min, max);
|
||||
if (min>boxhalfsize.x || max<-boxhalfsize.x) return false;
|
||||
FINDMINMAX(v0.x(), v1.x(), v2.x(), min, max);
|
||||
if (min>boxhalfsize.x() || max<-boxhalfsize.x()) return false;
|
||||
|
||||
/* test in Y-direction */
|
||||
FINDMINMAX(v0.y, v1.y, v2.y, min, max);
|
||||
if (min>boxhalfsize.y || max<-boxhalfsize.y) return false;
|
||||
FINDMINMAX(v0.y(), v1.y(), v2.y(), min, max);
|
||||
if (min>boxhalfsize.y() || max<-boxhalfsize.y()) return false;
|
||||
|
||||
/* test in Z-direction */
|
||||
FINDMINMAX(v0.z, v1.z, v2.z, min, max);
|
||||
if (min>boxhalfsize.z || max<-boxhalfsize.z) return false;
|
||||
FINDMINMAX(v0.z(), v1.z(), v2.z(), min, max);
|
||||
if (min>boxhalfsize.z() || max<-boxhalfsize.z()) return false;
|
||||
|
||||
/* Bullet 2: */
|
||||
/* test if the box intersects the plane of the triangle */
|
||||
|
@ -878,7 +878,7 @@ bool TriSphereIntersection(const zeus::CSphere& sphere,
|
|||
point = zeus::baryToWorld(trivert2, trivert1, trivert0, barys);
|
||||
|
||||
if (baryX == 0.f || baryX == 1.f || baryY == 0.f || baryY == 1.f ||
|
||||
barys.z == 0.f || barys.z == 1.f)
|
||||
barys.z() == 0.f || barys.z() == 1.f)
|
||||
normal = -sphere.getSurfaceNormal(point);
|
||||
else
|
||||
normal = (trivert1 - trivert0).cross(trivert2 - trivert0).normalized();
|
||||
|
|
|
@ -93,15 +93,15 @@ void Buckets::Sort()
|
|||
bool partial, full;
|
||||
if (planeObj.x3c_25_zOnly)
|
||||
{
|
||||
partial = drawable.GetBounds().max.z > planeObj.GetPlane().d;
|
||||
full = drawable.GetBounds().min.z > planeObj.GetPlane().d;
|
||||
partial = drawable.GetBounds().max.z() > planeObj.GetPlane().d();
|
||||
full = drawable.GetBounds().min.z() > planeObj.GetPlane().d();
|
||||
}
|
||||
else
|
||||
{
|
||||
partial = planeObj.GetPlane().pointToPlaneDist(
|
||||
drawable.GetBounds().closestPointAlongVector(planeObj.GetPlane().vec)) > 0.f;
|
||||
drawable.GetBounds().closestPointAlongVector(planeObj.GetPlane().normal())) > 0.f;
|
||||
full = planeObj.GetPlane().pointToPlaneDist(
|
||||
drawable.GetBounds().furthestPointAlongVector(planeObj.GetPlane().vec)) > 0.f;
|
||||
drawable.GetBounds().furthestPointAlongVector(planeObj.GetPlane().normal())) > 0.f;
|
||||
}
|
||||
bool cont;
|
||||
if (drawable.GetType() == EDrawableType::Particle)
|
||||
|
@ -378,7 +378,7 @@ void CBooRenderer::CalcDrawFogFan(const zeus::CPlane* planes, int numPlanes, con
|
|||
u32 insidePlaneCount = 0;
|
||||
bool outsidePlane[20];
|
||||
for (int i=0 ; i<numVerts ; ++i)
|
||||
outsidePlane[insidePlaneCount++] = plane.normal().dot(verts[i]) < plane.d;
|
||||
outsidePlane[insidePlaneCount++] = plane.normal().dot(verts[i]) < plane.d();
|
||||
|
||||
u32 numUseVerts = 0;
|
||||
zeus::CVector3f useVerts[20];
|
||||
|
@ -435,7 +435,7 @@ void CBooRenderer::DrawFogSlices(const zeus::CPlane* planes, int numPlanes,
|
|||
|
||||
zeus::CVector3d planeNormal = plane.normal();
|
||||
for (const zeus::CVector3d& vert : verts)
|
||||
verts2[vert2Count++] = vert - (planeNormal * zeus::CVector3f(planeNormal.dot(vert) - plane.d));
|
||||
verts2[vert2Count++] = vert - (planeNormal * zeus::CVector3f(planeNormal.dot(vert) - plane.d()));
|
||||
|
||||
CalcDrawFogFan(planes, numPlanes, verts2, vert2Count, iteration, 0, fogVol);
|
||||
}
|
||||
|
@ -452,21 +452,21 @@ void CBooRenderer::RenderFogVolumeModel(const zeus::CAABox& aabb, const CModel*
|
|||
zeus::CUnitVector3f viewNormal(viewMtx.basis[1]);
|
||||
zeus::CPlane planes[7] =
|
||||
{
|
||||
{zeus::CVector3f::skRight, xfAABB.min.x},
|
||||
{zeus::CVector3f::skLeft, -xfAABB.max.x},
|
||||
{zeus::CVector3f::skForward, xfAABB.min.y},
|
||||
{zeus::CVector3f::skBack, -xfAABB.max.y},
|
||||
{zeus::CVector3f::skUp, xfAABB.min.z},
|
||||
{zeus::CVector3f::skDown, -xfAABB.max.z},
|
||||
{zeus::CVector3f::skRight, xfAABB.min.x()},
|
||||
{zeus::CVector3f::skLeft, -xfAABB.max.x()},
|
||||
{zeus::CVector3f::skForward, xfAABB.min.y()},
|
||||
{zeus::CVector3f::skBack, -xfAABB.max.y()},
|
||||
{zeus::CVector3f::skUp, xfAABB.min.z()},
|
||||
{zeus::CVector3f::skDown, -xfAABB.max.z()},
|
||||
{viewNormal, viewNormal.dot(viewMtx.origin) + 0.2f + 0.1f}
|
||||
};
|
||||
|
||||
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
|
||||
|
||||
float longestAxis = std::max(std::max(
|
||||
xfAABB.max.x - xfAABB.min.x,
|
||||
xfAABB.max.y - xfAABB.min.y),
|
||||
xfAABB.max.z - xfAABB.min.z) * 2.f;
|
||||
xfAABB.max.x() - xfAABB.min.x(),
|
||||
xfAABB.max.y() - xfAABB.min.y()),
|
||||
xfAABB.max.z() - xfAABB.min.z()) * 2.f;
|
||||
|
||||
fvs->reset(7 * 6);
|
||||
for (int i=0 ; i<7 ; ++i)
|
||||
|
@ -541,23 +541,23 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
|
|||
zeus::CVector3f overW;
|
||||
if (i < 8)
|
||||
{
|
||||
overW = points[i].toVec3f() * (1.f / points[i].w);
|
||||
overW = points[i].toVec3f() * (1.f / points[i].w());
|
||||
}
|
||||
else
|
||||
{
|
||||
const zeus::CVector4f& pt1 = points[s_FogVolumeCtrl.xfc_[i-8][0]];
|
||||
const zeus::CVector4f& pt2 = points[s_FogVolumeCtrl.xfc_[i-8][1]];
|
||||
|
||||
bool eq1 = (pt1.z / pt1.w) == 1.f;
|
||||
bool eq2 = (pt2.z / pt2.w) == 1.f;
|
||||
bool eq1 = (pt1.z() / pt1.w()) == 1.f;
|
||||
bool eq2 = (pt2.z() / pt2.w()) == 1.f;
|
||||
if (eq1 == eq2)
|
||||
continue;
|
||||
|
||||
float interp = -(pt1.w - 1.f) / (pt2.w - pt1.w);
|
||||
float interp = -(pt1.w() - 1.f) / (pt2.w() - pt1.w());
|
||||
if (interp <= 0.f || interp >= 1.f)
|
||||
continue;
|
||||
|
||||
float wRecip = 1.f / (interp * (pt2.w - pt1.w) + pt1.w);
|
||||
float wRecip = 1.f / (interp * (pt2.w() - pt1.w()) + pt1.w());
|
||||
zeus::CVector3f pt1_3 = pt1.toVec3f();
|
||||
zeus::CVector3f pt2_3 = pt2.toVec3f();
|
||||
overW = (pt1_3 + interp * (pt2_3 - pt1_3)) * wRecip;
|
||||
|
@ -566,8 +566,8 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
|
|||
//if (overW.z > 1.001f)
|
||||
// continue;
|
||||
|
||||
int vpX = zeus::clamp(0, int(g_Viewport.x8_width * overW.x * 0.5f + (g_Viewport.x8_width / 2)), int(g_Viewport.x8_width));
|
||||
int vpY = zeus::clamp(0, int(g_Viewport.xc_height * overW.y * 0.5f + (g_Viewport.xc_height / 2)), int(g_Viewport.xc_height));
|
||||
int vpX = zeus::clamp(0, int(g_Viewport.x8_width * overW.x() * 0.5f + (g_Viewport.x8_width / 2)), int(g_Viewport.x8_width));
|
||||
int vpY = zeus::clamp(0, int(g_Viewport.xc_height * overW.y() * 0.5f + (g_Viewport.xc_height / 2)), int(g_Viewport.xc_height));
|
||||
vpMax.x = std::max(vpMax.x, vpX);
|
||||
vpMin.x = std::min(vpMin.x, vpX);
|
||||
vpMax.y = std::max(vpMax.y, vpY);
|
||||
|
@ -758,7 +758,7 @@ void CBooRenderer::AddWorldSurfaces(CBooModel& model)
|
|||
{
|
||||
const MaterialSet::Material& mat = model.GetMaterialByIndex(surf->m_data.matIdx);
|
||||
zeus::CAABox aabb = surf->GetBounds();
|
||||
zeus::CVector3f pt = aabb.closestPointAlongVector(xb0_viewPlane.vec);
|
||||
zeus::CVector3f pt = aabb.closestPointAlongVector(xb0_viewPlane.normal());
|
||||
Buckets::Insert(pt, aabb, EDrawableType::WorldSurface, surf, xb0_viewPlane,
|
||||
mat.heclIr.m_blendSrc == boo::BlendFactor::SrcAlpha &&
|
||||
mat.heclIr.m_blendDst == boo::BlendFactor::InvSrcAlpha);
|
||||
|
@ -1026,16 +1026,20 @@ void CBooRenderer::PostRenderFogs()
|
|||
x2ac_fogVolumes.sort([](const CFogVolumeListItem& a, const CFogVolumeListItem& b)
|
||||
{
|
||||
zeus::CAABox aabbA = a.x34_aabb.getTransformedAABox(a.x0_transform);
|
||||
bool insideA = aabbA.pointInside(zeus::CVector3f(CGraphics::g_ViewPoint.x, CGraphics::g_ViewPoint.y, aabbA.min.z));
|
||||
bool insideA = aabbA.pointInside(
|
||||
zeus::CVector3f(CGraphics::g_ViewPoint.x(), CGraphics::g_ViewPoint.y(), aabbA.min.z()));
|
||||
|
||||
zeus::CAABox aabbB = b.x34_aabb.getTransformedAABox(b.x0_transform);
|
||||
bool insideB = aabbB.pointInside(zeus::CVector3f(CGraphics::g_ViewPoint.x, CGraphics::g_ViewPoint.y, aabbB.min.z));
|
||||
bool insideB = aabbB.pointInside(
|
||||
zeus::CVector3f(CGraphics::g_ViewPoint.x(), CGraphics::g_ViewPoint.y(), aabbB.min.z()));
|
||||
|
||||
if (insideA != insideB)
|
||||
return insideA;
|
||||
|
||||
float dotA = aabbA.furthestPointAlongVector(CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]);
|
||||
float dotB = aabbB.furthestPointAlongVector(CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]);
|
||||
float dotA = aabbA.furthestPointAlongVector(
|
||||
CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]);
|
||||
float dotB = aabbB.furthestPointAlongVector(
|
||||
CGraphics::g_ViewMatrix.basis[1]).dot(CGraphics::g_ViewMatrix.basis[1]);
|
||||
return dotA < dotB;
|
||||
});
|
||||
for (const CFogVolumeListItem& fog : x2ac_fogVolumes)
|
||||
|
@ -1050,7 +1054,7 @@ void CBooRenderer::AddParticleGen(const CParticleGen& gen)
|
|||
{
|
||||
if (auto bounds = gen.GetBounds())
|
||||
{
|
||||
zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.vec);
|
||||
zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.normal());
|
||||
Buckets::Insert(pt, bounds.value(), EDrawableType::Particle, &gen, xb0_viewPlane, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1071,7 +1075,7 @@ void CBooRenderer::AddPlaneObject(const void* obj, const zeus::CAABox& aabb, con
|
|||
bool zOnly = plane.normal() == zeus::CVector3f::skUp;
|
||||
bool invert;
|
||||
if (zOnly)
|
||||
invert = CGraphics::g_ViewMatrix.origin.z >= plane.d;
|
||||
invert = CGraphics::g_ViewMatrix.origin.z() >= plane.d();
|
||||
else
|
||||
invert = plane.pointToPlaneDist(CGraphics::g_ViewMatrix.origin) >= 0.f;
|
||||
Buckets::InsertPlaneObject(closeDist, farDist, aabb, invert, plane, zOnly, EDrawableType(type + 2), obj);
|
||||
|
@ -1096,8 +1100,7 @@ void CBooRenderer::SetDrawableCallback(TDrawableCallback cb, const void* ctx)
|
|||
void CBooRenderer::SetWorldViewpoint(const zeus::CTransform& xf)
|
||||
{
|
||||
CGraphics::SetViewPointMatrix(xf);
|
||||
xb0_viewPlane.vec = xf.basis[1];
|
||||
xb0_viewPlane.d = xf.basis[1].dot(xf.origin);
|
||||
xb0_viewPlane = zeus::CPlane(xf.basis[1], xf.basis[1].dot(xf.origin));
|
||||
}
|
||||
|
||||
void CBooRenderer::SetPerspective(float fovy, float width, float height, float znear, float zfar)
|
||||
|
@ -1474,7 +1477,7 @@ int CBooRenderer::DrawOverlappingWorldModelIDs(int alphaVal, const std::vector<u
|
|||
if (alphaVal > 255)
|
||||
return alphaVal;
|
||||
|
||||
flags.x4_color.a = alphaVal / 255.f;
|
||||
flags.x4_color.a() = alphaVal / 255.f;
|
||||
const CBooModel& model = *item.x10_models[wordModel + j];
|
||||
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
||||
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
||||
|
@ -1495,7 +1498,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec
|
|||
const zeus::CAABox& aabb, float alpha) const
|
||||
{
|
||||
CModelFlags flags;
|
||||
flags.x4_color.a = alpha;
|
||||
flags.x4_color.a() = alpha;
|
||||
flags.m_extendedShader = EExtendedShader::MorphBallShadow; // Do shadow draw
|
||||
|
||||
u32 curWord = 0;
|
||||
|
@ -1517,7 +1520,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec
|
|||
if (alphaVal > 255)
|
||||
return;
|
||||
|
||||
flags.x4_color.r = alphaVal / 255.f;
|
||||
flags.x4_color.r() = alphaVal / 255.f;
|
||||
const CBooModel& model = *item.x10_models[wordModel + j];
|
||||
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
||||
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
||||
|
|
|
@ -397,8 +397,8 @@ void CGraphics::FlushProjection()
|
|||
zeus::CVector2i CGraphics::ProjectPoint(const zeus::CVector3f& point)
|
||||
{
|
||||
zeus::CVector3f projPt = GetPerspectiveProjectionMatrix(false).multiplyOneOverW(point);
|
||||
return {int(projPt.x * g_Viewport.x10_halfWidth) + int(g_Viewport.x10_halfWidth),
|
||||
int(g_Viewport.xc_height) - (int(projPt.y * g_Viewport.x14_halfHeight) +
|
||||
return {int(projPt.x() * g_Viewport.x10_halfWidth) + int(g_Viewport.x10_halfWidth),
|
||||
int(g_Viewport.xc_height) - (int(projPt.y() * g_Viewport.x14_halfHeight) +
|
||||
int(g_Viewport.x14_halfHeight))};
|
||||
}
|
||||
|
||||
|
@ -413,14 +413,14 @@ SClipScreenRect CGraphics::ClipScreenRectFromMS(const zeus::CVector3f& p1,
|
|||
SClipScreenRect CGraphics::ClipScreenRectFromVS(const zeus::CVector3f& p1,
|
||||
const zeus::CVector3f& p2)
|
||||
{
|
||||
if (p1.x == 0.f && p1.y == 0.f && p1.z == 0.f)
|
||||
if (p1.x() == 0.f && p1.y() == 0.f && p1.z() == 0.f)
|
||||
return {};
|
||||
if (p2.x == 0.f && p2.y == 0.f && p2.z == 0.f)
|
||||
if (p2.x() == 0.f && p2.y() == 0.f && p2.z() == 0.f)
|
||||
return {};
|
||||
|
||||
if (-p1.z < GetProjectionState().x14_near || -p2.z < GetProjectionState().x14_near)
|
||||
if (-p1.z() < GetProjectionState().x14_near || -p2.z() < GetProjectionState().x14_near)
|
||||
return {};
|
||||
if (-p1.z > GetProjectionState().x18_far || -p2.z > GetProjectionState().x18_far)
|
||||
if (-p1.z() > GetProjectionState().x18_far || -p2.z() > GetProjectionState().x18_far)
|
||||
return {};
|
||||
|
||||
zeus::CVector2i sp1 = ProjectPoint(p1);
|
||||
|
|
|
@ -34,7 +34,7 @@ float CLight::GetIntensity() const
|
|||
if (x1c_type == ELightType::Custom)
|
||||
coef = x30_angleC;
|
||||
const_cast<CLight*>(this)->x48_cachedIntensity =
|
||||
coef * std::max(x18_color.r, std::max(x18_color.g, x18_color.b));
|
||||
coef * std::max(x18_color.r(), std::max(x18_color.g(), x18_color.b()));
|
||||
}
|
||||
return x48_cachedIntensity;
|
||||
}
|
||||
|
|
|
@ -102,11 +102,13 @@ static bool IntersectLines(const zeus::CVector2f& pa1, const zeus::CVector2f& pa
|
|||
const zeus::CVector2f& pb1, const zeus::CVector2f& pb2,
|
||||
zeus::CVector3f& intersect)
|
||||
{
|
||||
float det = (pa1.x - pa2.x) * (pb1.y - pb2.y) - (pa1.y - pa2.y) * (pb1.x - pb2.x);
|
||||
zeus::CVector2f deltaA = pa1 - pa2;
|
||||
zeus::CVector2f deltaB = pb1 - pb2;
|
||||
float det = deltaA.cross(deltaB);
|
||||
if (std::fabs(det) < 0.000001f)
|
||||
return false;
|
||||
float c0 = pa1.x * pa2.y - pa1.y * pa2.x;
|
||||
float c1 = pb1.x * pb2.y - pb1.y * pb2.x;
|
||||
float c0 = pa1.cross(pa2);
|
||||
float c1 = pb1.cross(pb2);
|
||||
intersect = (c0 * (pb1 - pb2) - c1 * (pa1 - pa2)) / det;
|
||||
return true;
|
||||
}
|
||||
|
@ -154,13 +156,13 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
if (!dva.canBeNormalized())
|
||||
dva = {0.f, 1.f};
|
||||
dva = dva.normalized().perpendicularVector() * m_lastWidth;
|
||||
dva.x /= CGraphics::g_ProjAspect;
|
||||
dva.x() /= CGraphics::g_ProjAspect;
|
||||
|
||||
zeus::CVector2f dvb = (projPt - m_lastPos).toVec2f();
|
||||
if (!dvb.canBeNormalized())
|
||||
dvb = {0.f, 1.f};
|
||||
dvb = dvb.normalized().perpendicularVector() * m_lastWidth;
|
||||
dvb.x /= CGraphics::g_ProjAspect;
|
||||
dvb.x() /= CGraphics::g_ProjAspect;
|
||||
|
||||
if (m_textured)
|
||||
{
|
||||
|
@ -195,8 +197,8 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
|
||||
if (good1 && good2)
|
||||
{
|
||||
intersect1.z = m_lastPos.z;
|
||||
intersect2.z = m_lastPos.z;
|
||||
intersect1.z() = float(m_lastPos.z());
|
||||
intersect2.z() = float(m_lastPos.z());
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor, m_lastUV});
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor, m_lastUV});
|
||||
}
|
||||
|
@ -242,8 +244,8 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
|
||||
if (good1 && good2)
|
||||
{
|
||||
intersect1.z = m_lastPos.z;
|
||||
intersect2.z = m_lastPos.z;
|
||||
intersect1.z() = float(m_lastPos.z());
|
||||
intersect2.z() = float(m_lastPos.z());
|
||||
g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor});
|
||||
g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor});
|
||||
}
|
||||
|
@ -263,7 +265,7 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
if (!dv.canBeNormalized())
|
||||
dv = {0.f, 1.f};
|
||||
dv = dv.normalized().perpendicularVector() * m_lastWidth;
|
||||
dv.x /= CGraphics::g_ProjAspect;
|
||||
dv.x() /= CGraphics::g_ProjAspect;
|
||||
if (m_textured)
|
||||
{
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(m_lastPos + dv, m_lastW), m_lastColor, m_lastUV});
|
||||
|
@ -296,13 +298,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
if (!dva.canBeNormalized())
|
||||
dva = {0.f, 1.f};
|
||||
dva = dva.normalized().perpendicularVector() * m_lastWidth;
|
||||
dva.x /= CGraphics::g_ProjAspect;
|
||||
dva.x() /= CGraphics::g_ProjAspect;
|
||||
|
||||
zeus::CVector2f dvb = (m_firstPos - m_lastPos).toVec2f();
|
||||
if (!dvb.canBeNormalized())
|
||||
dvb = {0.f, 1.f};
|
||||
dvb = dvb.normalized().perpendicularVector() * m_lastWidth;
|
||||
dvb.x /= CGraphics::g_ProjAspect;
|
||||
dvb.x() /= CGraphics::g_ProjAspect;
|
||||
|
||||
zeus::CVector3f intersect1;
|
||||
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
|
||||
|
@ -320,8 +322,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
{
|
||||
if (good1 && good2)
|
||||
{
|
||||
intersect1.z = m_lastPos.z;
|
||||
intersect2.z = m_lastPos.z;
|
||||
intersect1.z() = float(m_lastPos.z());
|
||||
intersect2.z() = float(m_lastPos.z());
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor, m_lastUV});
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor, m_lastUV});
|
||||
}
|
||||
|
@ -337,8 +339,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
{
|
||||
if (good1 && good2)
|
||||
{
|
||||
intersect1.z = m_lastPos.z;
|
||||
intersect2.z = m_lastPos.z;
|
||||
intersect1.z() = float(m_lastPos.z());
|
||||
intersect2.z() = float(m_lastPos.z());
|
||||
g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor});
|
||||
g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor});
|
||||
}
|
||||
|
@ -356,13 +358,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
if (!dva.canBeNormalized())
|
||||
dva = {0.f, 1.f};
|
||||
dva = dva.normalized().perpendicularVector() * m_firstWidth;
|
||||
dva.x /= CGraphics::g_ProjAspect;
|
||||
dva.x() /= CGraphics::g_ProjAspect;
|
||||
|
||||
zeus::CVector2f dvb = (m_secondPos - m_firstPos).toVec2f();
|
||||
if (!dvb.canBeNormalized())
|
||||
dvb = {0.f, 1.f};
|
||||
dvb = dvb.normalized().perpendicularVector() * m_firstWidth;
|
||||
dvb.x /= CGraphics::g_ProjAspect;
|
||||
dvb.x() /= CGraphics::g_ProjAspect;
|
||||
|
||||
zeus::CVector3f intersect1;
|
||||
bool good1 = IntersectLines(m_lastPos.toVec2f() + dva, m_firstPos.toVec2f() + dva,
|
||||
|
@ -380,8 +382,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
{
|
||||
if (good1 && good2)
|
||||
{
|
||||
intersect1.z = m_firstPos.z;
|
||||
intersect2.z = m_firstPos.z;
|
||||
intersect1.z() = float(m_firstPos.z());
|
||||
intersect2.z() = float(m_firstPos.z());
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor, m_lastUV});
|
||||
g_StaticLineVertsTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor, m_lastUV});
|
||||
}
|
||||
|
@ -397,8 +399,8 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
{
|
||||
if (good1 && good2)
|
||||
{
|
||||
intersect1.z = m_firstPos.z;
|
||||
intersect2.z = m_firstPos.z;
|
||||
intersect1.z() = float(m_firstPos.z());
|
||||
intersect2.z() = float(m_firstPos.z());
|
||||
g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect1, m_lastW), m_lastColor});
|
||||
g_StaticLineVertsNoTex.push_back({zeus::CVector4f::ToClip(intersect2, m_lastW), m_lastColor});
|
||||
}
|
||||
|
@ -418,7 +420,7 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
if (!dv.canBeNormalized())
|
||||
dv = {0.f, 1.f};
|
||||
dv = dv.normalized().perpendicularVector() * m_lastWidth;
|
||||
dv.x /= CGraphics::g_ProjAspect;
|
||||
dv.x() /= CGraphics::g_ProjAspect;
|
||||
if (m_textured)
|
||||
{
|
||||
if (m_mode == EPrimitiveMode::Lines && (m_nextVert & 1))
|
||||
|
|
|
@ -90,7 +90,8 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
|
|||
else
|
||||
{
|
||||
surfPos = model.x20_aabb.center();
|
||||
surfSize = (model.x20_aabb.max.x - model.x20_aabb.min.x) + (model.x20_aabb.max.y - model.x20_aabb.min.y) * 0.5f;
|
||||
surfSize = (model.x20_aabb.max.x() - model.x20_aabb.min.x()) +
|
||||
(model.x20_aabb.max.y() - model.x20_aabb.min.y()) * 0.5f;
|
||||
}
|
||||
|
||||
if (g_Renderer->x318_24_refectionDirty)
|
||||
|
@ -131,11 +132,11 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
|
|||
float f1 = timeScale * g_TransformedTime;
|
||||
float f2 = timeScale * g_TransformedTime2;
|
||||
mtxsOut[1] = ReflectBaseMtx;
|
||||
mtxsOut[1][0][0] = f1 * v2.x;
|
||||
mtxsOut[1][1][0] = f1 * v2.y;
|
||||
mtxsOut[1][0][0] = f1 * v2.x();
|
||||
mtxsOut[1][1][0] = f1 * v2.y();
|
||||
mtxsOut[1][3][0] = -surfPos.dot(v2) * f1 + 0.5f;
|
||||
mtxsOut[1][2][1] = f2;
|
||||
mtxsOut[1][3][1] = -modelToPlayerLocal.z * f2;
|
||||
mtxsOut[1][3][1] = -modelToPlayerLocal.z() * f2;
|
||||
switch (CGraphics::g_BooPlatform)
|
||||
{
|
||||
case boo::IGraphicsDataFactory::Platform::OpenGL:
|
||||
|
@ -767,28 +768,28 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
|||
case UVAnimation::Mode::MvInvNoTranslation:
|
||||
{
|
||||
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||
texMtxOut.vec[3].w = 1.f;
|
||||
postMtxOut.vec[0].x = 0.5f;
|
||||
postMtxOut.vec[1].y = 0.5f;
|
||||
postMtxOut.vec[3].x = 0.5f;
|
||||
postMtxOut.vec[3].y = 0.5f;
|
||||
texMtxOut.m[3].w() = 1.f;
|
||||
postMtxOut.m[0].x() = 0.5f;
|
||||
postMtxOut.m[1].y() = 0.5f;
|
||||
postMtxOut.m[3].x() = 0.5f;
|
||||
postMtxOut.m[3].y() = 0.5f;
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::MvInv:
|
||||
{
|
||||
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||
texMtxOut.vec[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin;
|
||||
texMtxOut.vec[3].w = 1.f;
|
||||
postMtxOut.vec[0].x = 0.5f;
|
||||
postMtxOut.vec[1].y = 0.5f;
|
||||
postMtxOut.vec[3].x = 0.5f;
|
||||
postMtxOut.vec[3].y = 0.5f;
|
||||
texMtxOut.m[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin;
|
||||
texMtxOut.m[3].w() = 1.f;
|
||||
postMtxOut.m[0].x() = 0.5f;
|
||||
postMtxOut.m[1].y() = 0.5f;
|
||||
postMtxOut.m[3].x() = 0.5f;
|
||||
postMtxOut.m[3].y() = 0.5f;
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::Scroll:
|
||||
{
|
||||
texMtxOut.vec[3].x = CGraphics::GetSecondsMod900() * anim.vals[2] + anim.vals[0];
|
||||
texMtxOut.vec[3].y = CGraphics::GetSecondsMod900() * anim.vals[3] + anim.vals[1];
|
||||
texMtxOut.m[3].x() = CGraphics::GetSecondsMod900() * anim.vals[2] + anim.vals[0];
|
||||
texMtxOut.m[3].y() = CGraphics::GetSecondsMod900() * anim.vals[3] + anim.vals[1];
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::Rotation:
|
||||
|
@ -796,35 +797,35 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
|||
float angle = CGraphics::GetSecondsMod900() * anim.vals[1] + anim.vals[0];
|
||||
float acos = std::cos(angle);
|
||||
float asin = std::sin(angle);
|
||||
texMtxOut.vec[0].x = acos;
|
||||
texMtxOut.vec[0].y = asin;
|
||||
texMtxOut.vec[1].x = -asin;
|
||||
texMtxOut.vec[1].y = acos;
|
||||
texMtxOut.vec[3].x = (1.0f - (acos - asin)) * 0.5f;
|
||||
texMtxOut.vec[3].y = (1.0f - (asin + acos)) * 0.5f;
|
||||
texMtxOut.m[0].x() = acos;
|
||||
texMtxOut.m[0].y() = asin;
|
||||
texMtxOut.m[1].x() = -asin;
|
||||
texMtxOut.m[1].y() = acos;
|
||||
texMtxOut.m[3].x() = (1.0f - (acos - asin)) * 0.5f;
|
||||
texMtxOut.m[3].y() = (1.0f - (asin + acos)) * 0.5f;
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::HStrip:
|
||||
{
|
||||
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
|
||||
texMtxOut.vec[3].x = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
||||
texMtxOut.m[3].x() = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::VStrip:
|
||||
{
|
||||
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
|
||||
texMtxOut.vec[3].y = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
||||
texMtxOut.m[3].y() = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::Model:
|
||||
{
|
||||
texMtxOut = CGraphics::g_GXModelMatrix.toMatrix4f();
|
||||
texMtxOut.vec[3].zeroOut();
|
||||
postMtxOut.vec[0].x = 0.5f;
|
||||
postMtxOut.vec[1].y = 0.f;
|
||||
postMtxOut.vec[2].y = 0.5f;
|
||||
postMtxOut.vec[3].x = CGraphics::g_GXModelMatrix.origin.x * 0.05f;
|
||||
postMtxOut.vec[3].y = CGraphics::g_GXModelMatrix.origin.y * 0.05f;
|
||||
texMtxOut.m[3].zeroOut();
|
||||
postMtxOut.m[0].x() = 0.5f;
|
||||
postMtxOut.m[1].y() = 0.f;
|
||||
postMtxOut.m[2].y() = 0.5f;
|
||||
postMtxOut.m[3].x() = CGraphics::g_GXModelMatrix.origin.x() * 0.05f;
|
||||
postMtxOut.m[3].y() = CGraphics::g_GXModelMatrix.origin.y() * 0.05f;
|
||||
break;
|
||||
}
|
||||
case UVAnimation::Mode::CylinderEnvironment:
|
||||
|
@ -832,9 +833,9 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
|||
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||
|
||||
const zeus::CVector3f& viewOrigin = CGraphics::g_ViewMatrix.origin;
|
||||
float xy = (viewOrigin.x + viewOrigin.y) * 0.025f * anim.vals[1];
|
||||
float xy = (viewOrigin.x() + viewOrigin.y()) * 0.025f * anim.vals[1];
|
||||
xy = (xy - (int)xy);
|
||||
float z = (viewOrigin.z) * 0.05f * anim.vals[1];
|
||||
float z = (viewOrigin.z()) * 0.05f * anim.vals[1];
|
||||
z = (z - (int)z);
|
||||
|
||||
float halfA = anim.vals[0] * 0.5f;
|
||||
|
@ -879,12 +880,8 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
|||
{
|
||||
/* Special matrices for MorphBall shadow rendering */
|
||||
zeus::CMatrix4f texMtx =
|
||||
(zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max.x - flags.mbShadowBox.min.x),
|
||||
1.f / (flags.mbShadowBox.max.y - flags.mbShadowBox.min.y),
|
||||
1.f / (flags.mbShadowBox.max.z - flags.mbShadowBox.min.z)) *
|
||||
zeus::CTransform::Translate(-flags.mbShadowBox.min.x,
|
||||
-flags.mbShadowBox.min.y,
|
||||
-flags.mbShadowBox.min.z) * CGraphics::g_GXModelView).toMatrix4f();
|
||||
(zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max - flags.mbShadowBox.min)) *
|
||||
zeus::CTransform::Translate(-flags.mbShadowBox.min) * CGraphics::g_GXModelView).toMatrix4f();
|
||||
for (const MaterialSet::Material& mat : matSet->materials)
|
||||
{
|
||||
(void)mat;
|
||||
|
@ -907,11 +904,11 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
|||
zeus::CTransform::Translate(-aabb.min) * xf;
|
||||
zeus::CMatrix4f texMtx = xf.toMatrix4f();
|
||||
zeus::CMatrix4f post0 = DisintegratePost;
|
||||
post0[3].x = flags.addColor.a;
|
||||
post0[3].y = 6.f * -(1.f - flags.addColor.a) + 1.f;
|
||||
post0[3].x() = flags.addColor.a();
|
||||
post0[3].y() = 6.f * -(1.f - flags.addColor.a()) + 1.f;
|
||||
zeus::CMatrix4f post1 = DisintegratePost;
|
||||
post1[3].x = -0.85f * flags.addColor.a - 0.15f;
|
||||
post1[3].y = post0[3].y;
|
||||
post1[3].x() = -0.85f * flags.addColor.a() - 0.15f;
|
||||
post1[3].y() = float(post0[3].y());
|
||||
/* Special matrices for disintegration rendering */
|
||||
for (const MaterialSet::Material& mat : matSet->materials)
|
||||
{
|
||||
|
@ -941,10 +938,10 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
|||
*/
|
||||
|
||||
zeus::CMatrix4f& postMtxOut = (*specialMtxOut)[1];
|
||||
postMtxOut.vec[0].x = 0.5f;
|
||||
postMtxOut.vec[1].y = 0.5f;
|
||||
postMtxOut.vec[3].x = 0.5f;
|
||||
postMtxOut.vec[3].y = 0.5f;
|
||||
postMtxOut.m[0].x() = 0.5f;
|
||||
postMtxOut.m[1].y() = 0.5f;
|
||||
postMtxOut.m[3].x() = 0.5f;
|
||||
postMtxOut.m[3].y() = 0.5f;
|
||||
}
|
||||
else if (flags.m_extendedShader == EExtendedShader::WorldShadow)
|
||||
{
|
||||
|
@ -953,14 +950,14 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
|||
|
||||
zeus::CMatrix4f mat = g_shadowTexXf.toMatrix4f();
|
||||
zeus::CMatrix4f& texMtxOut = (*specialMtxOut)[0];
|
||||
texMtxOut[0][0] = mat[0][0];
|
||||
texMtxOut[1][0] = mat[1][0];
|
||||
texMtxOut[2][0] = mat[2][0];
|
||||
texMtxOut[3][0] = mat[3][0];
|
||||
texMtxOut[0][1] = mat[0][2];
|
||||
texMtxOut[1][1] = mat[1][2];
|
||||
texMtxOut[2][1] = mat[2][2];
|
||||
texMtxOut[3][1] = mat[3][2];
|
||||
texMtxOut[0][0] = float(mat[0][0]);
|
||||
texMtxOut[1][0] = float(mat[1][0]);
|
||||
texMtxOut[2][0] = float(mat[2][0]);
|
||||
texMtxOut[3][0] = float(mat[3][0]);
|
||||
texMtxOut[0][1] = float(mat[0][2]);
|
||||
texMtxOut[1][1] = float(mat[1][2]);
|
||||
texMtxOut[2][1] = float(mat[2][2]);
|
||||
texMtxOut[3][1] = float(mat[3][2]);
|
||||
}
|
||||
|
||||
for (const MaterialSet::Material& mat : matSet->materials)
|
||||
|
@ -1146,8 +1143,8 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
|||
{
|
||||
CModelShaders::MBShadowUniform& shadowOut = *reinterpret_cast<CModelShaders::MBShadowUniform*>(dataCur);
|
||||
shadowOut.shadowUp = CGraphics::g_GXModelView * zeus::CVector3f::skUp;
|
||||
shadowOut.shadowUp.w = flags.x4_color.a;
|
||||
shadowOut.shadowId = flags.x4_color.r;
|
||||
shadowOut.shadowUp.w() = flags.x4_color.a();
|
||||
shadowOut.shadowId = flags.x4_color.r();
|
||||
}
|
||||
else if (flags.m_extendedShader == EExtendedShader::Disintegrate)
|
||||
{
|
||||
|
@ -1470,12 +1467,12 @@ void CModel::ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBu
|
|||
{
|
||||
const std::pair<zeus::CVector3f, zeus::CVector3f>& avn = vn[i];
|
||||
float* floats = reinterpret_cast<float*>(data + GetPoolVertexOffset(i));
|
||||
floats[0] = avn.first.x;
|
||||
floats[1] = avn.first.y;
|
||||
floats[2] = avn.first.z;
|
||||
floats[3] = avn.second.x;
|
||||
floats[4] = avn.second.y;
|
||||
floats[5] = avn.second.z;
|
||||
floats[0] = avn.first.x();
|
||||
floats[1] = avn.first.y();
|
||||
floats[2] = avn.first.z();
|
||||
floats[3] = avn.second.x();
|
||||
floats[4] = avn.second.y();
|
||||
floats[5] = avn.second.z();
|
||||
}
|
||||
vertBuf->unmap();
|
||||
}
|
||||
|
|
|
@ -44,39 +44,39 @@ s32 CPVSVisOctree::IterateSearch(u8 nodeData, const zeus::CVector3f& tp) const
|
|||
zeus::CVector3f newMax;
|
||||
bool highFlags[3];
|
||||
|
||||
if (tp.x > newMin.x)
|
||||
if (tp.x() > newMin.x())
|
||||
{
|
||||
newMax.x = x2c_searchAabb.max.x;
|
||||
newMax.x() = x2c_searchAabb.max.x();
|
||||
highFlags[0] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newMax.x = newMin.x;
|
||||
newMin.x = x2c_searchAabb.min.x;
|
||||
newMax.x() = float(newMin.x());
|
||||
newMin.x() = float(x2c_searchAabb.min.x());
|
||||
highFlags[0] = false;
|
||||
}
|
||||
|
||||
if (tp.y > newMin.y)
|
||||
if (tp.y() > newMin.y())
|
||||
{
|
||||
newMax.y = x2c_searchAabb.max.y;
|
||||
newMax.y() = float(x2c_searchAabb.max.y());
|
||||
highFlags[1] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newMax.y = newMin.y;
|
||||
newMin.y = x2c_searchAabb.min.y;
|
||||
newMax.y() = float(newMin.y());
|
||||
newMin.y() = float(x2c_searchAabb.min.y());
|
||||
highFlags[1] = false;
|
||||
}
|
||||
|
||||
if (tp.z > newMin.z)
|
||||
if (tp.z() > newMin.z())
|
||||
{
|
||||
newMax.z = x2c_searchAabb.max.z;
|
||||
newMax.z() = float(x2c_searchAabb.max.z());
|
||||
highFlags[2] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newMax.z = newMin.z;
|
||||
newMin.z = x2c_searchAabb.min.z;
|
||||
newMax.z() = float(newMin.z());
|
||||
newMin.z() = float(x2c_searchAabb.min.z());
|
||||
highFlags[2] = false;
|
||||
}
|
||||
|
||||
|
@ -89,18 +89,18 @@ s32 CPVSVisOctree::IterateSearch(u8 nodeData, const zeus::CVector3f& tp) const
|
|||
zeus::CAABox& newSearch = const_cast<zeus::CAABox&>(x2c_searchAabb);
|
||||
if (nodeData & 0x1)
|
||||
{
|
||||
newSearch.min.x = newMin.x;
|
||||
newSearch.max.x = newMax.x;
|
||||
newSearch.min.x() = float(newMin.x());
|
||||
newSearch.max.x() = float(newMax.x());
|
||||
}
|
||||
if (nodeData & 0x2)
|
||||
{
|
||||
newSearch.min.y = newMin.y;
|
||||
newSearch.max.y = newMax.y;
|
||||
newSearch.min.y() = float(newMin.y());
|
||||
newSearch.max.y() = float(newMax.y());
|
||||
}
|
||||
if (nodeData & 0x4)
|
||||
{
|
||||
newSearch.min.z = newMin.z;
|
||||
newSearch.max.z = newMax.z;
|
||||
newSearch.min.z() = float(newMin.z());
|
||||
newSearch.max.z() = float(newMax.z());
|
||||
}
|
||||
|
||||
// Branch node - calculate next relative pointer
|
||||
|
|
|
@ -191,7 +191,7 @@ u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const std::vector<std::pair<zeus
|
|||
float distSq = (refVert.first - vert.first).magSquared();
|
||||
if (distSq > maxDist &&
|
||||
vert.second.dot(zeus::CVector3f::skUp) >= 0.f &&
|
||||
(vert.first.z <= 0.f || vert.first.z > minZ))
|
||||
(vert.first.z() <= 0.f || vert.first.z() > minZ))
|
||||
{
|
||||
nextPt = idx;
|
||||
maxDist = distSq;
|
||||
|
|
|
@ -18,16 +18,16 @@ zeus::CAABox CSimpleShadow::GetMaxShadowBox(const zeus::CAABox& aabb) const
|
|||
float extent = x34_radius * x30_scale;
|
||||
zeus::CVector3f center = aabb.center();
|
||||
zeus::CAABox expandedAABB = aabb;
|
||||
expandedAABB.accumulateBounds({center.x + extent, center.y + extent, center.z - GetMaxObjectHeight()});
|
||||
expandedAABB.accumulateBounds({center.x - extent, center.y - extent, center.z - GetMaxObjectHeight()});
|
||||
expandedAABB.accumulateBounds({center.x() + extent, center.y() + extent, center.z() - GetMaxObjectHeight()});
|
||||
expandedAABB.accumulateBounds({center.x() - extent, center.y() - extent, center.z() - GetMaxObjectHeight()});
|
||||
return expandedAABB;
|
||||
}
|
||||
|
||||
zeus::CAABox CSimpleShadow::GetBounds() const
|
||||
{
|
||||
float extent = x34_radius * x30_scale;
|
||||
return {{x0_xf.origin.x - extent, x0_xf.origin.y - extent, x0_xf.origin.z - extent},
|
||||
{x0_xf.origin.x + extent, x0_xf.origin.y + extent, x0_xf.origin.z + extent}};
|
||||
return {{x0_xf.origin.x() - extent, x0_xf.origin.y() - extent, x0_xf.origin.z() - extent},
|
||||
{x0_xf.origin.x() + extent, x0_xf.origin.y() + extent, x0_xf.origin.z() + extent}};
|
||||
}
|
||||
|
||||
void CSimpleShadow::Render(const TLockedToken<CTexture>& tex) const
|
||||
|
@ -55,7 +55,7 @@ void CSimpleShadow::Render(const TLockedToken<CTexture>& tex) const
|
|||
void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform& xf, const CStateManager& mgr)
|
||||
{
|
||||
x48_24_collision = false;
|
||||
float halfHeight = (aabb.max.z - aabb.min.z) * 0.5f;
|
||||
float halfHeight = (aabb.max.z() - aabb.min.z()) * 0.5f;
|
||||
zeus::CVector3f pos = xf.origin + zeus::CVector3f(0.f, 0.f, halfHeight);
|
||||
CRayCastResult res = mgr.RayStaticIntersection(pos, zeus::CVector3f::skDown, x40_maxObjHeight,
|
||||
CMaterialFilter::MakeExclude({EMaterialTypes::SeeThrough}));
|
||||
|
@ -88,8 +88,8 @@ void CSimpleShadow::Calculate(const zeus::CAABox& aabb, const zeus::CTransform&
|
|||
x0_xf.origin = res.GetPlane().normal() * x44_displacement + res.GetPoint();
|
||||
if (x48_25_alwaysCalculateRadius || !x48_26_radiusCalculated)
|
||||
{
|
||||
float xExtent = aabb.max.x - aabb.min.x;
|
||||
float yExtent = aabb.max.y - aabb.min.y;
|
||||
float xExtent = aabb.max.x() - aabb.min.x();
|
||||
float yExtent = aabb.max.y() - aabb.min.y();
|
||||
x34_radius = std::sqrt(xExtent * xExtent + yExtent * yExtent) * 0.5f;
|
||||
x48_26_radiusCalculated = true;
|
||||
}
|
||||
|
|
|
@ -39,45 +39,45 @@ void CAABoxShader::setAABB(const zeus::CAABox& aabb)
|
|||
{
|
||||
zeus::CVector3f vboData[] =
|
||||
{
|
||||
{aabb.max.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.max.z()},
|
||||
|
||||
{aabb.min.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.max.z()},
|
||||
|
||||
{aabb.min.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.max.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.max.z()},
|
||||
|
||||
{aabb.min.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.max.z()},
|
||||
|
||||
{aabb.min.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.max.z},
|
||||
{aabb.min.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.max.z},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.max.z()},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.max.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.max.z()},
|
||||
|
||||
{aabb.min.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.max.x, aabb.min.y, aabb.min.z},
|
||||
{aabb.min.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.max.x, aabb.max.y, aabb.min.z},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.max.x(), aabb.min.y(), aabb.min.z()},
|
||||
{aabb.min.x(), aabb.max.y(), aabb.min.z()},
|
||||
{aabb.max.x(), aabb.max.y(), aabb.min.z()},
|
||||
};
|
||||
|
||||
m_vbo->load(vboData, sizeof(zeus::CVector3f) * 34);
|
||||
|
|
|
@ -64,10 +64,10 @@ CColoredQuadFilter::CColoredQuadFilter(EFilterType type)
|
|||
|
||||
void CColoredQuadFilter::draw(const zeus::CColor& color, const zeus::CRectangle& rect)
|
||||
{
|
||||
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
|
||||
m_uniform.m_matrix[0][0] = rect.size.x() * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y() * 2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y() * 2.f - 1.f;
|
||||
m_uniform.m_color = color;
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
|
@ -85,7 +85,7 @@ void CWideScreenFilter::draw(const zeus::CColor& color, float t)
|
|||
delta /= float(g_Viewport.xc_height);
|
||||
zeus::CRectangle rect(0.f, 0.f, 1.f, delta);
|
||||
m_bottom.draw(color, rect);
|
||||
rect.position.y = 1.f - delta;
|
||||
rect.position.y() = 1.f - delta;
|
||||
m_top.draw(color, rect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ void CEnvFxShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& c
|
|||
auto iBufInfo = grid.m_instBuf.getBufferInfo();
|
||||
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {uBufInfo.first.get(),
|
||||
fxMgr.m_fogUniformBuf.get()};
|
||||
size_t ubufOffsets[] = {uBufInfo.second, 0};
|
||||
size_t ubufOffsets[] = {size_t(uBufInfo.second), 0};
|
||||
size_t ubufSizes[] = {sizeof(CEnvFxShaders::Uniform), sizeof(CGraphics::g_Fog)};
|
||||
boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment};
|
||||
boo::ObjToken<boo::ITexture> textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
|
||||
|
|
|
@ -264,23 +264,23 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info,
|
|||
continue;
|
||||
}
|
||||
zeus::CVector3f localPos = ripple.GetCenter() - waterCenter;
|
||||
rOut.center.x = localPos.x;
|
||||
rOut.center.y = localPos.y;
|
||||
rOut.center.z = ripple.GetTime() * ripple.GetOOTimeFalloff();
|
||||
rOut.center.w = ripple.GetOODistanceFalloff();
|
||||
rOut.params.x = ripple.GetAmplitude();
|
||||
rOut.params.y = ripple.GetPhase();
|
||||
rOut.params.z = (1.f - ripple.GetTime() * ripple.GetOOTimeFalloff() *
|
||||
ripple.GetOOTimeFalloff()) * ripple.GetFrequency();
|
||||
rOut.center.x() = float(localPos.x());
|
||||
rOut.center.y() = float(localPos.y());
|
||||
rOut.center.z() = ripple.GetTime() * ripple.GetOOTimeFalloff();
|
||||
rOut.center.w() = ripple.GetOODistanceFalloff();
|
||||
rOut.params.x() = ripple.GetAmplitude();
|
||||
rOut.params.y() = ripple.GetPhase();
|
||||
rOut.params.z() = (1.f - ripple.GetTime() * ripple.GetOOTimeFalloff() *
|
||||
ripple.GetOOTimeFalloff()) * ripple.GetFrequency();
|
||||
}
|
||||
uni.m_colorMul = colorMul;
|
||||
uni.m_pad[0].x = rippleNormResolution;
|
||||
uni.m_pad[0].x() = rippleNormResolution;
|
||||
uni.m_lighting.ActivateLights(info.lights);
|
||||
for (i=0 ; i<3 ; ++i)
|
||||
uni.m_lighting.colorRegs[i] = info.kColors[i];
|
||||
uni.m_lighting.mulColor = info.kColors[3];
|
||||
uni.m_lighting.fog = CGraphics::g_Fog;
|
||||
uni.m_pad2.x = info.indScale;
|
||||
uni.m_pad2.x() = info.indScale;
|
||||
m_uniBuf->unmap();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ void CSpaceWarpFilter::GenerateWarpRampTex(boo::IGraphicsDataFactory::Context& c
|
|||
vec.normalize();
|
||||
vec *= zeus::CVector2f(std::sqrt(mag));
|
||||
}
|
||||
data[y][x][0] = zeus::clamp(0, int((((vec.x / 2.f + 0.5f) - x / float(WARP_RAMP_RES)) + 0.5f) * 255), 255);
|
||||
data[y][x][1] = zeus::clamp(0, int((((vec.y / 2.f + 0.5f) - y / float(WARP_RAMP_RES)) + 0.5f) * 255), 255);
|
||||
data[y][x][0] = zeus::clamp(0, int((((vec.x() / 2.f + 0.5f) - x / float(WARP_RAMP_RES)) + 0.5f) * 255), 255);
|
||||
data[y][x][1] = zeus::clamp(0, int((((vec.y() / 2.f + 0.5f) - y / float(WARP_RAMP_RES)) + 0.5f) * 255), 255);
|
||||
}
|
||||
}
|
||||
m_warpTex = ctx.newStaticTexture(WARP_RAMP_RES+1, WARP_RAMP_RES+1, 1,
|
||||
|
@ -132,14 +132,14 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt)
|
|||
|
||||
/* Transform UV coordinates of rectangle within viewport and sampled scene texels (clamped to viewport bounds) */
|
||||
zeus::CVector2f vp{float(CGraphics::g_CroppedViewport.xc_width), float(CGraphics::g_CroppedViewport.x10_height)};
|
||||
m_uniform.m_matrix[0][0] = clipRect.xc_width / vp.x;
|
||||
m_uniform.m_matrix[1][1] = clipRect.x10_height / vp.y;
|
||||
m_uniform.m_matrix[3][0] = pt.x + (1.f / vp.x);
|
||||
m_uniform.m_matrix[3][1] = pt.y + (1.f / vp.y);
|
||||
m_uniform.m_matrix[0][0] = clipRect.xc_width / vp.x();
|
||||
m_uniform.m_matrix[1][1] = clipRect.x10_height / vp.y();
|
||||
m_uniform.m_matrix[3][0] = pt.x() + (1.f / vp.x());
|
||||
m_uniform.m_matrix[3][1] = pt.y() + (1.f / vp.y());
|
||||
if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL)
|
||||
m_uniform.m_matrix[3][2] = pt.z * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][2] = pt.z() * 2.f - 1.f;
|
||||
else
|
||||
m_uniform.m_matrix[3][2] = pt.z;
|
||||
m_uniform.m_matrix[3][2] = pt.z();
|
||||
|
||||
if (clipRect.x4_left)
|
||||
{
|
||||
|
@ -161,9 +161,9 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt)
|
|||
clipRect.x8_top = g_Viewport.xc_height - clipRect.x10_height - clipRect.x8_top;
|
||||
CGraphics::ResolveSpareTexture(clipRect);
|
||||
|
||||
m_uniform.m_strength.x = m_uniform.m_matrix[0][0] * m_strength * 0.5f *
|
||||
(clipRect.x10_height / float(clipRect.xc_width));
|
||||
m_uniform.m_strength.y = m_uniform.m_matrix[1][1] * m_strength * 0.5f;
|
||||
m_uniform.m_strength.x() = m_uniform.m_matrix[0][0] * m_strength * 0.5f *
|
||||
(clipRect.x10_height / float(clipRect.xc_width));
|
||||
m_uniform.m_strength.y() = m_uniform.m_matrix[1][1] * m_strength * 0.5f;
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
CGraphics::SetShaderDataBinding(m_dataBind);
|
||||
|
|
|
@ -66,22 +66,22 @@ void CTextSupportShader::ImageInstance::SetMetrics(const CFontImageDef& imgDef,
|
|||
if (imgDef.x4_texs.size())
|
||||
{
|
||||
const CTexture& tex = *imgDef.x4_texs[0].GetObj();
|
||||
imgSize.assign(tex.GetWidth() * imgDef.x14_cropFactor.x,
|
||||
tex.GetHeight() * imgDef.x14_cropFactor.y);
|
||||
imgSize.assign(tex.GetWidth() * imgDef.x14_cropFactor.x(),
|
||||
tex.GetHeight() * imgDef.x14_cropFactor.y());
|
||||
}
|
||||
zeus::CVector2f cropPad = imgDef.x14_cropFactor * 0.5f;
|
||||
|
||||
m_pos[0].assign(offset.x, 0.f, offset.y);
|
||||
m_uv[0].assign(0.5f - cropPad.x, 0.5f + cropPad.y);
|
||||
m_uv[0].assign(0.5f - cropPad.x(), 0.5f + cropPad.y());
|
||||
|
||||
m_pos[1].assign(offset.x + imgSize.x, 0.f, offset.y);
|
||||
m_uv[1].assign(0.5f + cropPad.x, 0.5f + cropPad.y);
|
||||
m_pos[1].assign(offset.x + imgSize.x(), 0.f, offset.y);
|
||||
m_uv[1].assign(0.5f + cropPad.x(), 0.5f + cropPad.y());
|
||||
|
||||
m_pos[2].assign(offset.x, 0.f, offset.y + imgSize.y);
|
||||
m_uv[2].assign(0.5f - cropPad.x, 0.5f - cropPad.y);
|
||||
m_pos[2].assign(offset.x, 0.f, offset.y + imgSize.y());
|
||||
m_uv[2].assign(0.5f - cropPad.x(), 0.5f - cropPad.y());
|
||||
|
||||
m_pos[3].assign(offset.x + imgSize.x, 0.f, offset.y + imgSize.y);
|
||||
m_uv[3].assign(0.5f + cropPad.x, 0.5f - cropPad.y);
|
||||
m_pos[3].assign(offset.x + imgSize.x(), 0.f, offset.y + imgSize.y());
|
||||
m_uv[3].assign(0.5f + cropPad.x(), 0.5f - cropPad.y());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -231,17 +231,17 @@ void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const z
|
|||
|
||||
if (!m_flipRect)
|
||||
{
|
||||
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
|
||||
m_uniform.m_matrix[0][0] = rect.size.x() * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y() * 2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y() * 2.f - 1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y * -2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y * -2.f + 1.f;
|
||||
m_uniform.m_matrix[0][0] = rect.size.x() * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y() * -2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y() * -2.f + 1.f;
|
||||
}
|
||||
m_uniform.m_color = color;
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
|
|
@ -79,15 +79,15 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const
|
|||
float shadowT = xe0_maxEnergy > 0.f ? xfc_shadowEnergy / xe0_maxEnergy : 0.f;
|
||||
|
||||
zeus::CColor filledColor = xd0_filledColor;
|
||||
filledColor.a *= drawParms.x0_alphaMod;
|
||||
filledColor.a() *= drawParms.x0_alphaMod;
|
||||
filledColor *= xa8_color2;
|
||||
|
||||
zeus::CColor shadowColor = xd4_shadowColor;
|
||||
shadowColor.a *= drawParms.x0_alphaMod;
|
||||
shadowColor.a() *= drawParms.x0_alphaMod;
|
||||
shadowColor *= xa8_color2;
|
||||
|
||||
zeus::CColor emptyColor = xcc_emptyColor;
|
||||
emptyColor.a *= drawParms.x0_alphaMod;
|
||||
emptyColor.a() *= drawParms.x0_alphaMod;
|
||||
emptyColor *= xa8_color2;
|
||||
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
|
|
|
@ -38,12 +38,12 @@ std::shared_ptr<CGuiWidget> CAuiImagePane::Create(CGuiFrame* frame, CInputStream
|
|||
|
||||
void CAuiImagePane::Update(float dt)
|
||||
{
|
||||
xd0_uvBias0.x = std::fmod(xd0_uvBias0.x, 1.f);
|
||||
xd0_uvBias0.y = std::fmod(xd0_uvBias0.y, 1.f);
|
||||
xd0_uvBias0.x() = std::fmod(xd0_uvBias0.x(), 1.f);
|
||||
xd0_uvBias0.y() = std::fmod(xd0_uvBias0.y(), 1.f);
|
||||
if (x138_tileSize != zeus::CVector2f::skZero && xb8_tex0Tok.IsLoaded())
|
||||
{
|
||||
zeus::CVector2f tmp = zeus::CVector2f(xb8_tex0Tok->GetWidth(), xb8_tex0Tok->GetHeight()) / x138_tileSize;
|
||||
x144_frameTimer = std::fmod(x144_frameTimer + dt * x140_interval, std::floor(tmp.x) * std::floor(tmp.y));
|
||||
x144_frameTimer = std::fmod(x144_frameTimer + dt * x140_interval, std::floor(tmp.x()) * std::floor(tmp.y()));
|
||||
}
|
||||
|
||||
CGuiWidget::Update(dt);
|
||||
|
@ -62,7 +62,7 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t
|
|||
int frame, float alpha, bool noBlur, CTexturedQuadFilterAlpha& quad) const
|
||||
{
|
||||
zeus::CColor useColor = color;
|
||||
useColor.a *= alpha;
|
||||
useColor.a() *= alpha;
|
||||
|
||||
rstl::reserved_vector<zeus::CVector2f, 4> vec;
|
||||
const rstl::reserved_vector<zeus::CVector2f, 4>* useUVs;
|
||||
|
@ -71,10 +71,10 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t
|
|||
zeus::CVector2f res(xb8_tex0Tok->GetWidth(), xb8_tex0Tok->GetHeight());
|
||||
zeus::CVector2f tmp = res / x138_tileSize;
|
||||
zeus::CVector2f tmpRecip = x138_tileSize / res;
|
||||
float x0 = tmpRecip.x * (frame % int(tmp.x));
|
||||
float x1 = x0 + tmpRecip.x;
|
||||
float y0 = tmpRecip.y * (frame % int(tmp.y));
|
||||
float y1 = y0 + tmpRecip.y;
|
||||
float x0 = tmpRecip.x() * (frame % int(tmp.x()));
|
||||
float x1 = x0 + tmpRecip.x();
|
||||
float y0 = tmpRecip.y() * (frame % int(tmp.y()));
|
||||
float y1 = y0 + tmpRecip.y();
|
||||
vec.push_back(zeus::CVector2f(x0, y0));
|
||||
vec.push_back(zeus::CVector2f(x0, y1));
|
||||
vec.push_back(zeus::CVector2f(x1, y0));
|
||||
|
@ -121,7 +121,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const
|
|||
const_cast<CAuiImagePane*>(this)->m_filters.emplace(const_cast<CAuiImagePane*>(this)->xb8_tex0Tok);
|
||||
Filters& filters = const_cast<Filters&>(*m_filters);
|
||||
zeus::CColor color = xa8_color2;
|
||||
color.a *= params.x0_alphaMod;
|
||||
color.a() *= params.x0_alphaMod;
|
||||
//SetZUpdate(xac_drawFlags == EGuiModelDrawFlags::Shadeless || xac_drawFlags == EGuiModelDrawFlags::Opaque);
|
||||
float blur0 = 1.f;
|
||||
float blur1 = 0.f;
|
||||
|
@ -130,7 +130,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const
|
|||
if (x140_interval < 1.f && x140_interval > 0.f)
|
||||
{
|
||||
zeus::CVector2f tmp = zeus::CVector2f(xb8_tex0Tok->GetWidth(), xb8_tex0Tok->GetHeight()) / x138_tileSize;
|
||||
frame1 = (frame0 + 1) % int(tmp.x * tmp.y);
|
||||
frame1 = (frame0 + 1) % int(tmp.x() * tmp.y());
|
||||
if (x148_fadeDuration == 0.f)
|
||||
blur1 = 1.f;
|
||||
else
|
||||
|
@ -145,7 +145,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const
|
|||
{
|
||||
// Additive blend
|
||||
zeus::CColor color2 = xa8_color2;
|
||||
color2.a = x150_flashFactor;
|
||||
color2.a() = x150_flashFactor;
|
||||
DoDrawImagePane(color2, *xb8_tex0Tok, frame0, blur0, false, filters.m_flashQuad[0]);
|
||||
if (blur1 > 0.f)
|
||||
DoDrawImagePane(color2, *xb8_tex0Tok, frame1, blur1, false, filters.m_flashQuad[1]);
|
||||
|
|
|
@ -610,7 +610,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetLockConfirmColor();
|
||||
color.a *= lockBreakAlpha;
|
||||
color.a() *= lockBreakAlpha;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
x4c_lockConfirm->Draw(flags);
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetTargetFlowerColor();
|
||||
color.a *= lockBreakAlpha * visorFactor;
|
||||
color.a() *= lockBreakAlpha * visorFactor;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
x58_targetFlower->Draw(flags);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetMissileBracketColor();
|
||||
color.a *= lockBreakAlpha * visorFactor;
|
||||
color.a() *= lockBreakAlpha * visorFactor;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
x64_missileBracket->Draw(flags);
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetOuterBeamSquareColor();
|
||||
color.a *= lockBreakAlpha * visorFactor;
|
||||
color.a() *= lockBreakAlpha * visorFactor;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
info.x0_model->Draw(flags);
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
zeus::CTransform modelXf(lockBreakXf * chargeGaugeXf, x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = gaugeColor;
|
||||
color.a *= lockBreakAlpha * visorFactor;
|
||||
color.a() *= lockBreakAlpha * visorFactor;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
xc4_chargeGauge.x0_model->Draw(flags);
|
||||
|
||||
|
@ -754,7 +754,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
zeus::CTransform modelXf(lockBreakXf * rot * scale, x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = *iconColor;
|
||||
color.a *= lockBreakAlpha * visorFactor;
|
||||
color.a() *= lockBreakAlpha * visorFactor;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
x70_innerBeamIcon->Draw(flags);
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetLockFireColor();
|
||||
color.a *= visorFactor * lockBreakAlpha * (x210_lockFireTimer / g_tweakTargeting->GetLockFireDuration());
|
||||
color.a() *= visorFactor * lockBreakAlpha * (x210_lockFireTimer / g_tweakTargeting->GetLockFireDuration());
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
x7c_lockFire->Draw(flags);
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x10c_currGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetLockDaggerColor();
|
||||
color.a *= visorFactor * lockBreakAlpha;
|
||||
color.a() *= visorFactor * lockBreakAlpha;
|
||||
CModelFlags flags(7, 0, 0, lockBreakColor + color);
|
||||
x88_lockDagger->Draw(flags);
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x174_nextGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetSeekerColor();
|
||||
color.a *= x174_nextGroupInterp.GetFactor();
|
||||
color.a() *= x174_nextGroupInterp.GetFactor();
|
||||
CModelFlags flags(7, 0, 0, color);
|
||||
x40_seeker->Draw(flags);
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
x174_nextGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetXRayRetRingColor();
|
||||
color.a *= visorFactor;
|
||||
color.a() *= visorFactor;
|
||||
CModelFlags flags(7, 0, 0, color);
|
||||
xac_xrayRetRing->Draw(flags);
|
||||
}
|
||||
|
@ -887,7 +887,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
zeus::CTransform modelXf(rot * scale, x174_nextGroupInterp.GetTargetPositionWorld());
|
||||
CGraphics::SetModelMatrix(modelXf);
|
||||
zeus::CColor color = g_tweakTargeting->GetThermalReticuleColor();
|
||||
color.a *= visorFactor;
|
||||
color.a() *= visorFactor;
|
||||
CModelFlags flags(7, 0, 0, color);
|
||||
xb8_thermalReticle->Draw(flags);
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
|
|||
// compare, GX_LESS, no update
|
||||
float alpha = 0.5f * factor;
|
||||
zeus::CColor color = g_tweakGuiColors->GetScanReticuleColor();
|
||||
color.a *= alpha;
|
||||
color.a() *= alpha;
|
||||
for (int i=0 ; i<2 ; ++i)
|
||||
{
|
||||
float lineWidth = i ? 2.5f : 1.f;
|
||||
|
@ -948,7 +948,7 @@ void CCompoundTargetReticle::DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, cons
|
|||
{
|
||||
CGraphics::SetModelMatrix(zeus::CTransform(rot, xf4_targetPos) * zeus::CTransform::Scale(x1e8_crosshairsScale));
|
||||
zeus::CColor color = g_tweakTargeting->GetCrosshairsColor();
|
||||
color.a *= x1e8_crosshairsScale;
|
||||
color.a() *= x1e8_crosshairsScale;
|
||||
CModelFlags flags(7, 0, 0, color);
|
||||
x34_crosshairs->Draw(flags);
|
||||
}
|
||||
|
@ -980,17 +980,17 @@ float CCompoundTargetReticle::CalculateRadiusWorld(const CActor& act, const CSta
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
radius = std::min(delta.x, std::min(delta.y, delta.z)) * 0.5f;
|
||||
radius = std::min(delta.x(), std::min(delta.y(), delta.z())) * 0.5f;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
radius = std::max(delta.x, std::max(delta.y, delta.z)) * 0.5f;
|
||||
radius = std::max(delta.x(), std::max(delta.y(), delta.z())) * 0.5f;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
radius = (delta.x + delta.y + delta.z) / 6.f;
|
||||
radius = (delta.x() + delta.y() + delta.z()) / 6.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1030,9 +1030,9 @@ float CCompoundTargetReticle::CalculateClampedScale(const zeus::CVector3f& pos,
|
|||
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
|
||||
mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
|
||||
zeus::CVector3f viewPos = cam->GetTransform().transposeRotate(pos - cam->GetTransform().origin);
|
||||
viewPos = zeus::CVector3f(viewPos.x, viewPos.z, -viewPos.y);
|
||||
float realX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x;
|
||||
float offsetX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x;
|
||||
viewPos = zeus::CVector3f(viewPos.x(), viewPos.z(), -viewPos.y());
|
||||
float realX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x();
|
||||
float offsetX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x();
|
||||
float unclampedX = (offsetX - realX) * 640;
|
||||
return zeus::clamp(clampMin, unclampedX, clampMax) / unclampedX * scale;
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ bool CFontImageDef::IsLoaded() const
|
|||
s32 CFontImageDef::CalculateBaseline() const
|
||||
{
|
||||
const CTexture* tex = x4_texs.front().GetObj();
|
||||
return s32(tex->GetHeight() * x14_cropFactor.y) * 2.5f / 3.f;
|
||||
return s32(tex->GetHeight() * x14_cropFactor.y()) * 2.5f / 3.f;
|
||||
}
|
||||
|
||||
s32 CFontImageDef::CalculateHeight() const
|
||||
{
|
||||
const CTexture* tex = x4_texs.front().GetObj();
|
||||
s32 scaledH = tex->GetHeight() * x14_cropFactor.y;
|
||||
s32 scaledH = tex->GetHeight() * x14_cropFactor.y();
|
||||
return scaledH - (scaledH - CalculateBaseline());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ zeus::CVector3f CGuiCamera::ConvertToScreenSpace(const zeus::CVector3f& vec) con
|
|||
zeus::CMatrix4f mat = CGraphics::CalculatePerspectiveMatrix(m_proj.xbc_fov, m_proj.xc0_aspect,
|
||||
m_proj.xc4_znear, m_proj.xc8_zfar,
|
||||
false);
|
||||
local = zeus::CVector3f(local.x, local.z, -local.y);
|
||||
local = zeus::CVector3f(local.x(), local.z(), -local.y());
|
||||
return mat.multiplyOneOverW(local);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void CGuiFrame::SortDrawOrder()
|
|||
std::sort(x2c_widgets.begin(), x2c_widgets.end(),
|
||||
[](const std::shared_ptr<CGuiWidget>& a, const std::shared_ptr<CGuiWidget>& b) -> bool
|
||||
{
|
||||
return a->GetWorldPosition().y > b->GetWorldPosition().y;
|
||||
return a->GetWorldPosition().y() > b->GetWorldPosition().y();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
|
|||
if (GetIsVisible())
|
||||
{
|
||||
zeus::CColor moduCol = xa8_color2;
|
||||
moduCol.a *= parms.x0_alphaMod;
|
||||
moduCol.a() *= parms.x0_alphaMod;
|
||||
xb0_frame->EnableLights(xcc_lightMask, const_cast<CBooModel&>(model->GetInstance()));
|
||||
//if (xb6_29_cullFaces)
|
||||
// CGraphics::SetCullMode(ERglCullMode::Front);
|
||||
|
|
|
@ -39,10 +39,10 @@ void CGuiPane::InitializeBuffers()
|
|||
if (xc0_verts.size() < 4)
|
||||
xc0_verts.resize(4);
|
||||
|
||||
xc0_verts[0].m_pos.assign(-xb8_dim.x * 0.5f, 0.f, xb8_dim.y * 0.5f);
|
||||
xc0_verts[1].m_pos.assign(-xb8_dim.x * 0.5f, 0.f, -xb8_dim.y * 0.5f);
|
||||
xc0_verts[2].m_pos.assign(xb8_dim.x * 0.5f, 0.f, xb8_dim.y * 0.5f);
|
||||
xc0_verts[3].m_pos.assign(xb8_dim.x * 0.5f, 0.f, -xb8_dim.y * 0.5f);
|
||||
xc0_verts[0].m_pos.assign(-xb8_dim.x() * 0.5f, 0.f, xb8_dim.y() * 0.5f);
|
||||
xc0_verts[1].m_pos.assign(-xb8_dim.x() * 0.5f, 0.f, -xb8_dim.y() * 0.5f);
|
||||
xc0_verts[2].m_pos.assign(xb8_dim.x() * 0.5f, 0.f, xb8_dim.y() * 0.5f);
|
||||
xc0_verts[3].m_pos.assign(xb8_dim.x() * 0.5f, 0.f, -xb8_dim.y() * 0.5f);
|
||||
}
|
||||
|
||||
void CGuiPane::WriteData(COutputStream& out, bool flag) const
|
||||
|
|
|
@ -46,22 +46,22 @@ void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) const
|
|||
zeus::CVector2f dims = GetDimensions();
|
||||
|
||||
if (xd4_textSupport.x34_extentX)
|
||||
dims.x /= float(xd4_textSupport.x34_extentX);
|
||||
dims.x() /= float(xd4_textSupport.x34_extentX);
|
||||
else
|
||||
dims.x = 0.f;
|
||||
dims.x() = 0.f;
|
||||
|
||||
if (xd4_textSupport.x38_extentY)
|
||||
dims.y /= float(xd4_textSupport.x38_extentY);
|
||||
dims.y() /= float(xd4_textSupport.x38_extentY);
|
||||
else
|
||||
dims.y = 0.f;
|
||||
dims.y() = 0.f;
|
||||
|
||||
zeus::CTransform local =
|
||||
zeus::CTransform::Translate(xc0_verts.front().m_pos + xc8_scaleCenter) *
|
||||
zeus::CTransform::Scale(dims.x, 1.f, dims.y);
|
||||
zeus::CTransform::Scale(dims.x(), 1.f, dims.y());
|
||||
CGraphics::SetModelMatrix(x34_worldXF * local);
|
||||
|
||||
zeus::CColor geomCol = xa8_color2;
|
||||
geomCol.a *= parms.x0_alphaMod;
|
||||
geomCol.a() *= parms.x0_alphaMod;
|
||||
const_cast<CGuiTextPane*>(this)->xd4_textSupport.SetGeometryColor(geomCol);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -32,7 +32,7 @@ void CHudBossEnergyInterface::Update(float dt)
|
|||
if (x4_fader > 0.f)
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = x0_alpha * x4_fader;
|
||||
color.a() = x0_alpha * x4_fader;
|
||||
x14_basewidget_bossenergystuff->SetColor(color);
|
||||
x14_basewidget_bossenergystuff->SetVisibility(true, ETraversalMode::Children);
|
||||
}
|
||||
|
|
|
@ -88,14 +88,14 @@ void CHudDecoInterfaceCombat::Update(float dt, const CStateManager& stateMgr)
|
|||
void CHudDecoInterfaceCombat::UpdateCameraDebugSettings(float fov, float y, float z)
|
||||
{
|
||||
x6c_camera->SetFov(fov);
|
||||
x2c_camPos.y = y;
|
||||
x2c_camPos.z = z;
|
||||
x2c_camPos.y() = y;
|
||||
x2c_camPos.z() = z;
|
||||
}
|
||||
|
||||
void CHudDecoInterfaceCombat::UpdateHudAlpha()
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
x70_basewidget_pivot->SetColor(color);
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ void CHudDecoInterfaceScan::UpdateScanDisplay(const CStateManager& stateMgr, flo
|
|||
if (x238_scanningTextAlpha > 0.f)
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = std::min(x238_scanningTextAlpha, 1.f);
|
||||
color.a() = std::min(x238_scanningTextAlpha, 1.f);
|
||||
x254_flat_textpane_scanning->SetColor(color);
|
||||
x254_flat_textpane_scanning->SetIsVisible(true);
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ void CHudDecoInterfaceScan::UpdateScanDisplay(const CStateManager& stateMgr, flo
|
|||
if (x23c_scanBarAlpha > 0.f)
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = std::min(x23c_scanBarAlpha, 1.f);
|
||||
color.a() = std::min(x23c_scanBarAlpha, 1.f);
|
||||
x258_flat_basewidget_scanguage->SetColor(color);
|
||||
x258_flat_basewidget_scanguage->SetVisibility(true, ETraversalMode::Children);
|
||||
}
|
||||
|
@ -398,14 +398,14 @@ void CHudDecoInterfaceScan::ProcessInput(const CFinalInput& input)
|
|||
void CHudDecoInterfaceScan::UpdateCameraDebugSettings(float fov, float y, float z)
|
||||
{
|
||||
x244_camera->SetFov(fov);
|
||||
x20c_camPos.y = y;
|
||||
x20c_camPos.z = z;
|
||||
x20c_camPos.y() = y;
|
||||
x20c_camPos.z() = z;
|
||||
}
|
||||
|
||||
void CHudDecoInterfaceScan::UpdateHudAlpha()
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
x248_basewidget_pivot->SetColor(color);
|
||||
}
|
||||
|
||||
|
@ -511,14 +511,14 @@ void CHudDecoInterfaceXRay::Update(float dt, const CStateManager& stateMgr)
|
|||
void CHudDecoInterfaceXRay::UpdateCameraDebugSettings(float fov, float y, float z)
|
||||
{
|
||||
xa0_camera->SetFov(fov);
|
||||
x30_camPos.y = y;
|
||||
x30_camPos.z = z;
|
||||
x30_camPos.y() = y;
|
||||
x30_camPos.z() = z;
|
||||
}
|
||||
|
||||
void CHudDecoInterfaceXRay::UpdateHudAlpha()
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
xa4_basewidget_pivot->SetColor(color);
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ void CHudDecoInterfaceThermal::Update(float dt, const CStateManager& stateMgr)
|
|||
x6c_retflashTimer -= 2.f;
|
||||
|
||||
zeus::CColor flashColor = zeus::CColor::skWhite;
|
||||
flashColor.a = std::fabs(x6c_retflashTimer) * 0.5f + 0.5f;
|
||||
flashColor.a() = std::fabs(x6c_retflashTimer) * 0.5f + 0.5f;
|
||||
x80_model_retflash->SetColor(flashColor);
|
||||
|
||||
x74_camera->SetO2WTransform(
|
||||
|
@ -639,14 +639,14 @@ void CHudDecoInterfaceThermal::Update(float dt, const CStateManager& stateMgr)
|
|||
void CHudDecoInterfaceThermal::UpdateCameraDebugSettings(float fov, float y, float z)
|
||||
{
|
||||
x74_camera->SetFov(fov);
|
||||
x2c_camPos.y = y;
|
||||
x2c_camPos.z = z;
|
||||
x2c_camPos.y() = y;
|
||||
x2c_camPos.z() = z;
|
||||
}
|
||||
|
||||
void CHudDecoInterfaceThermal::UpdateHudAlpha()
|
||||
{
|
||||
zeus::CColor color = zeus::CColor::skWhite;
|
||||
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
color.a() = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||
x78_basewidget_pivot->SetColor(color);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue