mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
various fixes
STB probably shouldn't fail on failed info, just continue. Assimp only add sequences if there are any. Update kork chan asset.
This commit is contained in:
parent
cd6656be35
commit
6355da5df6
7 changed files with 44 additions and 67 deletions
|
|
@ -200,8 +200,7 @@ bool sReadSTB(const Torque::Path& path, GBitmap* bitmap)
|
||||||
if (!stbErr)
|
if (!stbErr)
|
||||||
stbErr = "Unknown Error!";
|
stbErr = "Unknown Error!";
|
||||||
|
|
||||||
Con::errorf("STB failed to get image info: %s", stbErr);
|
Con::errorf("STB get file info: %s", stbErr);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// do this to map 2 channels to 4, 2 channel not supported by gbitmap yet..
|
// do this to map 2 channels to 4, 2 channel not supported by gbitmap yet..
|
||||||
|
|
@ -331,8 +330,7 @@ bool sReadStreamSTB(Stream& stream, GBitmap* bitmap, U32 len)
|
||||||
if (!stbErr)
|
if (!stbErr)
|
||||||
stbErr = "Unknown Error!";
|
stbErr = "Unknown Error!";
|
||||||
|
|
||||||
Con::errorf("STB failed to get image info: %s", stbErr);
|
Con::errorf("STB get memory info: %s", stbErr);
|
||||||
Con::warnf("Going to attempt to load stream anyway.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 reqCom = comp;
|
S32 reqCom = comp;
|
||||||
|
|
|
||||||
|
|
@ -261,38 +261,40 @@ void AssimpShapeLoader::processAnimations()
|
||||||
|
|
||||||
Vector<aiNodeAnim*> ambientChannels;
|
Vector<aiNodeAnim*> ambientChannels;
|
||||||
F32 duration = 0.0f;
|
F32 duration = 0.0f;
|
||||||
|
if (mScene->mNumAnimations > 0)
|
||||||
for (U32 i = 0; i < mScene->mNumAnimations; ++i)
|
|
||||||
{
|
{
|
||||||
aiAnimation* anim = mScene->mAnimations[i];
|
for (U32 i = 0; i < mScene->mNumAnimations; ++i)
|
||||||
for (U32 j = 0; j < anim->mNumChannels; j++)
|
|
||||||
{
|
{
|
||||||
aiNodeAnim* nodeAnim = anim->mChannels[j];
|
aiAnimation* anim = mScene->mAnimations[i];
|
||||||
// Determine the maximum keyframe time for this animation
|
for (U32 j = 0; j < anim->mNumChannels; j++)
|
||||||
F32 maxKeyTime = 0.0f;
|
{
|
||||||
for (U32 k = 0; k < nodeAnim->mNumPositionKeys; k++) {
|
aiNodeAnim* nodeAnim = anim->mChannels[j];
|
||||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
|
// Determine the maximum keyframe time for this animation
|
||||||
}
|
F32 maxKeyTime = 0.0f;
|
||||||
for (U32 k = 0; k < nodeAnim->mNumRotationKeys; k++) {
|
for (U32 k = 0; k < nodeAnim->mNumPositionKeys; k++) {
|
||||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
|
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
|
||||||
}
|
}
|
||||||
for (U32 k = 0; k < nodeAnim->mNumScalingKeys; k++) {
|
for (U32 k = 0; k < nodeAnim->mNumRotationKeys; k++) {
|
||||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
|
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
|
||||||
}
|
}
|
||||||
|
for (U32 k = 0; k < nodeAnim->mNumScalingKeys; k++) {
|
||||||
|
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
|
||||||
|
}
|
||||||
|
|
||||||
ambientChannels.push_back(nodeAnim);
|
ambientChannels.push_back(nodeAnim);
|
||||||
|
|
||||||
duration = getMax(duration, maxKeyTime);
|
duration = getMax(duration, maxKeyTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ambientSeq->mNumChannels = ambientChannels.size();
|
||||||
|
ambientSeq->mChannels = ambientChannels.address();
|
||||||
|
ambientSeq->mDuration = duration;
|
||||||
|
ambientSeq->mTicksPerSecond = 24.0;
|
||||||
|
|
||||||
|
AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
|
||||||
|
appSequences.push_back(defaultAssimpSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
ambientSeq->mNumChannels = ambientChannels.size();
|
|
||||||
ambientSeq->mChannels = ambientChannels.address();
|
|
||||||
ambientSeq->mDuration = duration;
|
|
||||||
ambientSeq->mTicksPerSecond = 24.0;
|
|
||||||
|
|
||||||
AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
|
|
||||||
appSequences.push_back(defaultAssimpSeq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssimpShapeLoader::computeBounds(Box3F& bounds)
|
void AssimpShapeLoader::computeBounds(Box3F& bounds)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<ShapeAsset
|
|
||||||
AssetName="kork_chanShape"
|
|
||||||
fileName="@assetFile=kork_chanShape.fbx"
|
|
||||||
constuctorFileName="@assetFile=kork_chanShape.tscript"
|
|
||||||
materialSlot0="@asset=Prototyping:kork_chan_mat"
|
|
||||||
originalFilePath="C:/dev/T3D/PRs/MiscFixes20220525/Templates/BaseGame/game/data/Prototyping/shapes/kork_chanShape.fbx"/>
|
|
||||||
|
|
@ -1,28 +1,8 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
new TSShapeConstructor(kork_chanShape_fbx) {
|
singleton TSShapeConstructor(kork_chanShapefbx)
|
||||||
baseShapeAsset = "Prototyping:kork_chanShape";
|
{
|
||||||
upAxis = "DEFAULT";
|
baseShapeAsset = ":kork_chanShape_shape";
|
||||||
unit = "-1";
|
|
||||||
LODType = "TrailingNumber";
|
|
||||||
singleDetailSize = "0";
|
singleDetailSize = "0";
|
||||||
IgnoreNodeScale = "0";
|
neverImportMat = "DefaultMaterial ColorEffect*";
|
||||||
AdjustCenter = "0";
|
|
||||||
AdjustFloor = "0";
|
|
||||||
forceUpdateMaterials = "0";
|
|
||||||
convertLeftHanded = "0";
|
|
||||||
calcTangentSpace = "0";
|
|
||||||
genUVCoords = "0";
|
|
||||||
transformUVCoords = "0";
|
|
||||||
flipUVCoords = "1";
|
|
||||||
findInstances = "0";
|
|
||||||
limitBoneWeights = "0";
|
|
||||||
JoinIdenticalVerts = "1";
|
|
||||||
reverseWindingOrder = "1";
|
|
||||||
invertNormals = "0";
|
|
||||||
removeRedundantMats = "1";
|
|
||||||
animTiming = "Seconds";
|
|
||||||
animFPS = "2";
|
animFPS = "2";
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
};
|
};
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<ShapeAsset
|
||||||
|
AssetName="kork_chanShape_shape"
|
||||||
|
fileName="@assetFile=kork_chanShape.fbx"
|
||||||
|
constuctorFileName="@assetFile=kork_chanShape.tscript"
|
||||||
|
materialSlot0="@asset=Prototyping:kork_chan_mat"/>
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
<ImageAsset
|
<ImageAsset
|
||||||
AssetName="kork_chan_image"
|
AssetName="kork_chan_image"
|
||||||
imageFile="@assetFile=kork_chan.png"
|
imageFile="@assetFile=kork_chan.png"/>
|
||||||
originalFilePath="C:/dev/T3D/PRs/MiscFixes20220525/Templates/BaseGame/game/data/Prototyping/shapes/kork_chan.png"/>
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@
|
||||||
<Material
|
<Material
|
||||||
Name="kork_chan_mat"
|
Name="kork_chan_mat"
|
||||||
mapTo="kork_chan"
|
mapTo="kork_chan"
|
||||||
alphaTest="true"
|
doubleSided="true"
|
||||||
alphaRef="100">
|
originalAssetName="kork_chan_mat">
|
||||||
<Material.Stages>
|
<Material.Stages>
|
||||||
<Stages_beginarray
|
<Stages_beginarray
|
||||||
DiffuseMapAsset="Prototyping:kork_chan_image"
|
DiffuseMapAsset="Prototyping:kork_chan_image"/>
|
||||||
doubleSided="true"/>
|
|
||||||
</Material.Stages>
|
</Material.Stages>
|
||||||
</Material>
|
</Material>
|
||||||
</MaterialAsset>
|
</MaterialAsset>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue