Fix issues with billboard lock X and Y

This commit is contained in:
Retera 2021-03-08 08:30:36 -05:00
parent 9249c8e6df
commit 53c9e20c3f
5 changed files with 110 additions and 105 deletions

View File

@ -1,53 +1,26 @@
// This is the Warsmash INI file for Project Revolution
// PRSCMOD
[DataSources]
Count=8
Count=9
Type00=MPQ
Path00="D:\Games\Warcraft III Patch 1.22\war3.mpq"
Path00="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\war3.mpq"
Type01=MPQ
Path01="D:\Games\Warcraft III Patch 1.22\War3x.mpq"
Path01="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\War3x.mpq"
Type02=MPQ
Path02="D:\Games\Warcraft III Patch 1.22\War3xlocal.mpq"
Path02="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\War3xlocal.mpq"
Type03=MPQ
Path03="D:\Games\Warcraft III Patch 1.22\War3Patch.mpq"
Type04=Folder
Path04="..\..\resources"
Type05=Folder
Path05="D:\Backups\Warsmash\Data"
Path03="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\war3patch.mpq"
Type04=MPQ
Path04="D:\Games\Warcraft III Project Revolution\PRSCMOD\Revolution.mpq"
Type05=MPQ
Path05="D:\Games\Warcraft III Project Revolution\PRSCMOD\Sound.mpq"
Type06=Folder
Path06="D:\Games\Warcraft III Patch 1.22\Maps"
Path06="D:\Games\Warcraft III Project Revolution\ProjectRevolusmash"
Type07=Folder
Path07="."
Path07="..\..\resources"
Type08=Folder
Path08="D:\Games\Warcraft III Project Revolution\PRSCMOD\PR-Maps"
[Map]
//FilePath="CombatUnitTests.w3x"
//FilePath="PitchRoll.w3x"
//FilePath="PeonStartingBase_Simple.w3x"
FilePath="PeonStartingBase_Scythe.w3x"
//FilePath="MyStromguarde.w3m"
//FilePath="ColdArrows.w3m"
//FilePath="DungeonGoldMine.w3m"
//FilePath="PlayerPeasants.w3m"
//FilePath="FireLord.w3x"
//FilePath="Maps\Campaign\NightElf03.w3m"
//FilePath="PhoenixAttack.w3x"
//FilePath="LightEnvironmentTest.w3x"
//FilePath="TorchLight2.w3x"
//FilePath="OrcAssault.w3x"
//FilePath="FrostyVsFarm.w3m"
//FilePath="ModelTest.w3x"
//FilePath="SpinningSample.w3x"
//FilePath="Maps\Campaign\Prologue02.w3m"
//FilePath="Pathing.w3x"
//FilePath="ItemFacing.w3x"
//FilePath=SomeParticleTests.w3x
//FilePath="PeonMiningMultiHall.w3x"
//FilePath="QuadtreeBugs.w3x"
//FilePath="test2.w3x"
//FilePath="FarseerHoldPositionTest.w3x"
//FilePath="Ramps.w3m"
//FilePath="V1\Farm.w3x"
//FilePath="PenguinWorld.w3x"
//FilePath="Maps\FrozenThrone\Campaign\UndeadX09.w3x"
//FilePath="LavellaLagoon.w3x"
//FilePath="WiceOrc.w3x"
//FilePath="NorthrendPathingDoodle.w3x"
//FilePath="Maps\Campaign\Prologue01.w3m"
FilePath="ProjectRevolusmash.w3x"

View File

@ -0,0 +1,53 @@
[DataSources]
Count=8
Type00=MPQ
Path00="D:\Games\Warcraft III Patch 1.22\war3.mpq"
Type01=MPQ
Path01="D:\Games\Warcraft III Patch 1.22\War3x.mpq"
Type02=MPQ
Path02="D:\Games\Warcraft III Patch 1.22\War3xlocal.mpq"
Type03=MPQ
Path03="D:\Games\Warcraft III Patch 1.22\War3Patch.mpq"
Type04=Folder
Path04="..\..\resources"
Type05=Folder
Path05="D:\Backups\Warsmash\Data"
Type06=Folder
Path06="D:\Games\Warcraft III Patch 1.22\Maps"
Type07=Folder
Path07="."
[Map]
//FilePath="CombatUnitTests.w3x"
//FilePath="PitchRoll.w3x"
//FilePath="PeonStartingBase_Simple.w3x"
FilePath="PeonStartingBase_Scythe.w3x"
//FilePath="MyStromguarde.w3m"
//FilePath="ColdArrows.w3m"
//FilePath="DungeonGoldMine.w3m"
//FilePath="PlayerPeasants.w3m"
//FilePath="FireLord.w3x"
//FilePath="Maps\Campaign\NightElf03.w3m"
//FilePath="PhoenixAttack.w3x"
//FilePath="LightEnvironmentTest.w3x"
//FilePath="TorchLight2.w3x"
//FilePath="OrcAssault.w3x"
//FilePath="FrostyVsFarm.w3m"
//FilePath="ModelTest.w3x"
//FilePath="SpinningSample.w3x"
//FilePath="Maps\Campaign\Prologue02.w3m"
//FilePath="Pathing.w3x"
//FilePath="ItemFacing.w3x"
//FilePath=SomeParticleTests.w3x
//FilePath="PeonMiningMultiHall.w3x"
//FilePath="QuadtreeBugs.w3x"
//FilePath="test2.w3x"
//FilePath="FarseerHoldPositionTest.w3x"
//FilePath="Ramps.w3m"
//FilePath="V1\Farm.w3x"
//FilePath="PenguinWorld.w3x"
//FilePath="Maps\FrozenThrone\Campaign\UndeadX09.w3x"
//FilePath="LavellaLagoon.w3x"
//FilePath="WiceOrc.w3x"
//FilePath="NorthrendPathingDoodle.w3x"
//FilePath="Maps\Campaign\Prologue01.w3m"

View File

@ -1,26 +0,0 @@
// This is the Warsmash INI file for Project Revolution
// PRSCMOD
[DataSources]
Count=9
Type00=MPQ
Path00="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\war3.mpq"
Type01=MPQ
Path01="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\War3x.mpq"
Type02=MPQ
Path02="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\War3xlocal.mpq"
Type03=MPQ
Path03="D:\Games\Warcraft III Project Revolution\War3\The Sheep Attack\war3patch.mpq"
Type04=MPQ
Path04="D:\Games\Warcraft III Project Revolution\PRSCMOD\Revolution.mpq"
Type05=MPQ
Path05="D:\Games\Warcraft III Project Revolution\PRSCMOD\Sound.mpq"
Type06=Folder
Path06="D:\Games\Warcraft III Project Revolution\ProjectRevolusmash"
Type07=Folder
Path07="..\..\resources"
Type08=Folder
Path08="D:\Games\Warcraft III Project Revolution\PRSCMOD\PR-Maps"
[Map]
FilePath="ProjectRevolusmash.w3x"

View File

@ -12,7 +12,6 @@ public abstract class SkeletalNode extends GenericNode {
protected static final Vector3 billboardAxisHeap = new Vector3();
protected static final Quaternion rotationHeap = new Quaternion();
protected static final Quaternion rotationHeap2 = new Quaternion();
protected static final Quaternion rotationHeap3 = new Quaternion();
protected static final Vector3 scalingHeap = new Vector3();
protected static final Vector3 blendLocationHeap = new Vector3();
protected static final Vector3 blendHeap = new Vector3();
@ -120,76 +119,77 @@ public abstract class SkeletalNode extends GenericNode {
this.convertBasis(computedRotation);
}
else {
computedRotation = rotationHeap.set(this.localRotation);
if (!Float.isNaN(blendTimeRatio) && (blendTimeRatio > 0)) {
rotationHeap.set(this.localRotation).slerp(this.localBlendRotation, blendTimeRatio);
computedRotation = rotationHeap;
}
else {
computedRotation = this.localRotation;
computedRotation.slerp(this.localBlendRotation, blendTimeRatio);
}
if (this.billboardedX) {
if (computedScaling == this.localScale) {
computedScaling = scalingHeap.set(computedScaling);
}
// It took me many hours to deduce from playing around that this negative one
// multiplier should be here. I suggest a lot of testing before you remove it.
computedScaling.z *= -1;
final Camera camera = scene.camera;
cameraRayHeap.set(camera.billboardedVectors[6]);
rotationHeap2.set(this.parent.inverseWorldRotation);
rotationHeap3.set(computedRotation);
rotationHeap2.set(computedRotation);
// Inverse that local rotation
rotationHeap3.x = -rotationHeap3.x;
rotationHeap3.y = -rotationHeap3.y;
rotationHeap3.z = -rotationHeap3.z;
rotationHeap2.x = -rotationHeap2.x;
rotationHeap2.y = -rotationHeap2.y;
rotationHeap2.z = -rotationHeap2.z;
rotationHeap3.mul(rotationHeap2);
rotationHeap2.mul(this.parent.inverseWorldRotation);
rotationHeap3.transform(cameraRayHeap);
rotationHeap2.transform(cameraRayHeap);
billboardAxisHeap.set(1, 0, 0);
final float angle = (float) Math.atan2(cameraRayHeap.z, cameraRayHeap.y);
rotationHeap3.setFromAxisRad(billboardAxisHeap, angle);
rotationHeap2.setFromAxisRad(billboardAxisHeap, angle);
RenderMathUtils.mul(computedRotation, computedRotation, rotationHeap3);
RenderMathUtils.mul(computedRotation, computedRotation, rotationHeap2);
}
else if (this.billboardedY) {
final Camera camera = scene.camera;
cameraRayHeap.set(camera.billboardedVectors[6]);
rotationHeap2.set(this.parent.inverseWorldRotation);
rotationHeap3.set(computedRotation);
rotationHeap2.set(computedRotation);
// Inverse that local rotation
rotationHeap3.x = -rotationHeap3.x;
rotationHeap3.y = -rotationHeap3.y;
rotationHeap3.z = -rotationHeap3.z;
rotationHeap2.x = -rotationHeap2.x;
rotationHeap2.y = -rotationHeap2.y;
rotationHeap2.z = -rotationHeap2.z;
rotationHeap3.mul(rotationHeap2);
rotationHeap2.mul(this.parent.inverseWorldRotation);
rotationHeap3.transform(cameraRayHeap);
rotationHeap2.transform(cameraRayHeap);
billboardAxisHeap.set(0, 1, 0);
final float angle = (float) Math.atan2(cameraRayHeap.z, -cameraRayHeap.x);
rotationHeap3.setFromAxisRad(billboardAxisHeap, angle);
final float angle = (float) Math.atan2(-cameraRayHeap.z, cameraRayHeap.x);
rotationHeap2.setFromAxisRad(billboardAxisHeap, angle);
RenderMathUtils.mul(computedRotation, computedRotation, rotationHeap3);
RenderMathUtils.mul(computedRotation, computedRotation, rotationHeap2);
}
else if (this.billboardedZ) {
final Camera camera = scene.camera;
cameraRayHeap.set(camera.billboardedVectors[6]);
rotationHeap2.set(this.parent.inverseWorldRotation);
rotationHeap3.set(computedRotation);
rotationHeap2.set(computedRotation);
// Inverse that local rotation
rotationHeap3.x = -rotationHeap3.x;
rotationHeap3.y = -rotationHeap3.y;
rotationHeap3.z = -rotationHeap3.z;
rotationHeap2.x = -rotationHeap2.x;
rotationHeap2.y = -rotationHeap2.y;
rotationHeap2.z = -rotationHeap2.z;
rotationHeap3.mul(rotationHeap2);
rotationHeap2.mul(this.parent.inverseWorldRotation);
rotationHeap3.transform(cameraRayHeap);
rotationHeap2.transform(cameraRayHeap);
billboardAxisHeap.set(0, 0, 1);
final float angle = (float) Math.atan2(cameraRayHeap.y, cameraRayHeap.x);
rotationHeap3.setFromAxisRad(billboardAxisHeap, angle);
rotationHeap2.setFromAxisRad(billboardAxisHeap, angle);
RenderMathUtils.mul(computedRotation, computedRotation, rotationHeap3);
RenderMathUtils.mul(computedRotation, computedRotation, rotationHeap2);
}
}

View File

@ -98,7 +98,12 @@ public class BatchGroup extends GenericGroup {
final float layerAlpha = instance.layerAlphas[layerIndex];
if ((geosetColor[3] > 0) && (layerAlpha > 0)) {
final int layerTexture = instance.layerTextures[layerIndex];
// BELOW: I updated it to "Math.max(0," because MDL and MDX parser for PRSCMOD
// menu screen behaved differently,
// the MDL case was getting "no data" for default value when unanimated, and "no
// data" resolved to -1,
// whereas MDX binary contained an "unused" 0 value.
final int layerTexture = Math.max(0, instance.layerTextures[layerIndex]);
final float[] uvAnim = instance.uvAnims[layerIndex];
shader.setUniform4fv("u_geosetColor", geosetColor, 0, geosetColor.length);