Merge remote-tracking branch 'upstream/development' into ShaderConstBuffer-CleanupRefactor

This commit is contained in:
marauder2k7 2024-03-01 17:52:37 +00:00
commit d8636f754b
9 changed files with 58 additions and 70 deletions

View file

@ -97,7 +97,7 @@ endif (WIN32 AND TORQUE_D3D11)
# Handle core # Handle core
torqueAddSourceDirectories("core" "core/stream" "core/strings" "core/util" torqueAddSourceDirectories("core" "core/stream" "core/strings" "core/util"
"core/util/journal" "core/util/zip" "core/util/compressors") "core/util/journal" "core/util/zip" "core/util/zip/compressors")
# Handle GUI # Handle GUI
torqueAddSourceDirectories("gui" "gui/buttons" "gui/containers" "gui/controls" "gui/core" torqueAddSourceDirectories("gui" "gui/buttons" "gui/containers" "gui/controls" "gui/core"
"gui/game" "gui/shiny" "gui/utility" "gui/3d") "gui/game" "gui/shiny" "gui/utility" "gui/3d")

View file

@ -1279,9 +1279,14 @@ template<> void *Resource<GBitmap>::create(const Torque::Path &path)
const String extension = path.getExtension(); const String extension = path.getExtension();
if( !bmp->readBitmap( extension, path ) ) if( !bmp->readBitmap( extension, path ) )
{ {
Con::errorf( "Resource<GBitmap>::create - error reading '%s'", path.getFullPath().c_str() ); // we can only get here if the stream was successful, so attempt to read the stream.
delete bmp; Con::warnf("Was unable to load as file, going to try the stream instead.");
bmp = NULL; if (!bmp->readBitmapStream(extension, stream, stream.getStreamSize()))
{
Con::errorf("Resource<GBitmap>::create - error reading '%s'", path.getFullPath().c_str());
delete bmp;
bmp = NULL;
}
} }
return bmp; return bmp;

View file

@ -195,7 +195,12 @@ bool sReadSTB(const Torque::Path& path, GBitmap* bitmap)
if (!stbi_info(path.getFullPath().c_str(), &x, &y, &channels)) if (!stbi_info(path.getFullPath().c_str(), &x, &y, &channels))
{ {
FrameAllocator::setWaterMark(prevWaterMark); FrameAllocator::setWaterMark(prevWaterMark);
return false; const char* stbErr = stbi_failure_reason();
if (!stbErr)
stbErr = "Unknown Error!";
Con::errorf("STB get file info: %s", stbErr);
} }
// 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..
@ -325,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);
return false;
} }
S32 reqCom = comp; S32 reqCom = comp;

View file

@ -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)

View file

@ -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"/>

View file

@ -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 ---

View file

@ -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"/>

View file

@ -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"/>

View file

@ -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>