Skip to content

Commit

Permalink
Merge pull request #39 from dkavolis/more_geom_fixes
Browse files Browse the repository at this point in the history
More GeometryPartModule fixes
  • Loading branch information
dkavolis authored Apr 4, 2019
2 parents cdb2a11 + 4e8b158 commit 80e0f65
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 8 deletions.
29 changes: 23 additions & 6 deletions FerramAerospaceResearch/FARPartGeometry/GeometryPartModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public bool Valid
unignoredTransforms;
[SerializeField]
bool ignoreIfNoRenderer;
[SerializeField]
bool rebuildOnAnimation;

#if DEBUG
class DebugInfoBuilder
Expand Down Expand Up @@ -629,7 +631,13 @@ private void CheckAnimations()
++_sendUpdateTick;

if(updateShape)
UpdateShapeWithAnims(); //event to update voxel, with rate limiter for computer's sanity and error reduction
{
if (rebuildOnAnimation)
RebuildAllMeshData();
else
UpdateShapeWithAnims(); //event to update voxel, with rate limiter for computer's sanity and error reduction
UpdateVoxelShape();
}
}

private void UpdateShapeWithAnims()
Expand All @@ -641,8 +649,6 @@ private void UpdateShapeWithAnims()
transformMatrix = EditorLogic.RootPart.partTransform.worldToLocalMatrix;

UpdateTransformMatrixList(transformMatrix);

UpdateVoxelShape();
}

private void UpdateVoxelShape()
Expand Down Expand Up @@ -848,15 +854,25 @@ private List<MeshData> CreateMeshListFromTransforms(ref List<Transform> meshTran

if (part.Modules.Contains<ModuleJettison>())
{
bool variants = part.Modules.Contains<ModulePartVariants>();
List<ModuleJettison> jettisons = part.Modules.GetModules<ModuleJettison>();
HashSet<Transform> jettisonTransforms = new HashSet<Transform>();
HashSet<string> jettisonTransforms = new HashSet<string>();
for(int i = 0; i < jettisons.Count; i++)
{
ModuleJettison j = jettisons[i];
if (j.jettisonTransform == null)
continue;

jettisonTransforms.Add(j.jettisonTransform);
if (variants)
{
// with part variants, jettison name is a comma separated list of transform names
foreach (string name in j.jettisonName.Split(','))
{
jettisonTransforms.Add(name);
}
}
else
jettisonTransforms.Add(j.jettisonTransform.name);
if (j.isJettisoned)
continue;

Expand All @@ -878,7 +894,7 @@ private List<MeshData> CreateMeshListFromTransforms(ref List<Transform> meshTran
{
foreach (Transform t in meshTransforms)
{
if (jettisonTransforms.Contains(t))
if (jettisonTransforms.Contains(t.name))
continue;
MeshData md = GetVisibleMeshData(t, ignoreIfNoRenderer, false);
if (md == null)
Expand Down Expand Up @@ -1003,6 +1019,7 @@ public override void OnLoad(ConfigNode node)
LoadBool(node, "forceUseMeshes", out forceUseMeshes);
LoadBool(node, "ignoreForMainAxis", out ignoreForMainAxis);
LoadBool(node, "ignoreIfNoRenderer", out ignoreIfNoRenderer);
LoadBool(node, "rebuildOnAnimation", out rebuildOnAnimation);
ignoredTransforms = LoadList(node, "ignoreTransform");
unignoredTransforms = LoadList(node, "unignoreTransform");
}
Expand Down
167 changes: 166 additions & 1 deletion GameData/FerramAerospaceResearch/FARVoxelGeometryOverrides.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
{
@MODULE[GeometryPartModule]
{
%forceUseColliders = True
%forceUseMeshes = True
%ignoreIfNoRenderer = true
%rebuildOnAnimation = true
}
}
@PART[KW3mPetalAdapter]:AFTER[FerramAerospaceResearch]
Expand Down Expand Up @@ -41,6 +43,169 @@
%forceUseMeshes = True
}
}
@PART[liquidEngineMini_v2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[JetEngine]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[turboFanSize2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[LiquidEngineKE-1]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[Size3AdvancedEngine]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[Size2LFB]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[liquidEngine3_v2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[nuclearEngine]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[liquidEngine]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[LiquidEngineLV-T91]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%ignoreIfNoRenderer = true
}
}
@PART[LiquidEngineLV-TX87]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%ignoreIfNoRenderer = true
}
}
@PART[LiquidEngineRE-I2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[engineLargeSkipper]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[liquidEngine2-2_v2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%ignoreIfNoRenderer = true
}
}
@PART[liquidEngine1-2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[LiquidEngineRK-7]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[solidBooster_v2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[solidBooster_sm_v2]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[LiquidEngineRV-1]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%forceUseMeshes = true
%ignoreIfNoRenderer = true
}
}
@PART[SSME]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%ignoreIfNoRenderer = true
}
}
@PART[toroidalAerospike]:AFTER[FerramAerospaceResearch]
{
@MODULE[GeometryPartModule]
{
%ignoreIfNoRenderer = true
}
}

//axis ignoring
@PART[structuralPanel1]:AFTER[FerramAerospaceResearch]
Expand Down
Binary file not shown.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ CHANGELOG
=======================================================
-------------------master branch-------------------

Fix voxelization of most stock engines ([#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39))
Voxelization correctly handles jettison transforms with part variants ([#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39))
Fix voxelization of `InflatableHeatShield` ([#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39))
Fixed voxelization of simple heat shields ([#37](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/37))
Added additional nodes to `GeometryPartModule` ([#37](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/37), see PR for more details):
Added additional nodes to `GeometryPartModule` ([#37](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/37), [#39](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/39), see PRs for more details). The new nodes should allow parts to be voxelized much closer to what is visible and handle animations better:
* `ignoreTransform` (string)
* `ignoreIfNoRenderer` (bool)
* `unignoreTransform` (string)
* `rebuildOnAnimation` (bool)

NRE fixes ([#36](https://github.com/dkavolis/Ferram-Aerospace-Research/pull/36)):
* Trying to display debug voxels with no parts in the editor
Expand Down
Binary file modified bin/Debug/FerramAerospaceResearch.dll
Binary file not shown.
Binary file modified bin/Debug/ferramGraph.dll
Binary file not shown.

0 comments on commit 80e0f65

Please sign in to comment.