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