mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Remove failed attempt at a culling fix
This commit is contained in:
parent
da1fbf0f2a
commit
3637f84f5c
@ -358,7 +358,7 @@ namespace ConformalDecals {
|
|||||||
if (mesh == null) continue; // object has a null mesh, invalid
|
if (mesh == null) continue; // object has a null mesh, invalid
|
||||||
|
|
||||||
// create new ProjectionTarget to represent the renderer
|
// create new ProjectionTarget to represent the renderer
|
||||||
var target = new ProjectionTarget(renderer, mesh, useBaseNormal);
|
var target = new ProjectionTarget(renderer, mesh);
|
||||||
|
|
||||||
// add the target to the list
|
// add the target to the list
|
||||||
_targets.Add(target);
|
_targets.Add(target);
|
||||||
|
@ -10,22 +10,15 @@ namespace ConformalDecals {
|
|||||||
private readonly Renderer _targetRenderer;
|
private readonly Renderer _targetRenderer;
|
||||||
private readonly Mesh _targetMesh;
|
private readonly Mesh _targetMesh;
|
||||||
private bool _projectionEnabled;
|
private bool _projectionEnabled;
|
||||||
private readonly int _cullMode;
|
|
||||||
|
|
||||||
// property block
|
// property block
|
||||||
private readonly MaterialPropertyBlock _decalMPB;
|
private readonly MaterialPropertyBlock _decalMPB;
|
||||||
|
|
||||||
public ProjectionTarget(MeshRenderer targetRenderer, Mesh targetMesh, bool useBaseNormal) {
|
public ProjectionTarget(MeshRenderer targetRenderer, Mesh targetMesh) {
|
||||||
target = targetRenderer.transform;
|
target = targetRenderer.transform;
|
||||||
_targetRenderer = targetRenderer;
|
_targetRenderer = targetRenderer;
|
||||||
_targetMesh = targetMesh;
|
_targetMesh = targetMesh;
|
||||||
_decalMPB = new MaterialPropertyBlock();
|
_decalMPB = new MaterialPropertyBlock();
|
||||||
|
|
||||||
var targetScale = target.lossyScale;
|
|
||||||
Debug.Log($"{target.name} scale = {targetScale}");
|
|
||||||
var targetDeterminant = (targetScale.x * targetScale.y * targetScale.z);
|
|
||||||
_cullMode = targetDeterminant < 0 ? (int) CullMode.Front : (int) CullMode.Back;
|
|
||||||
_decalMPB.SetInt(DecalPropertyIDs._Cull, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Project(Matrix4x4 orthoMatrix, OrientedBounds projectorBounds, Transform projector, bool useBaseNormal) {
|
public void Project(Matrix4x4 orthoMatrix, OrientedBounds projectorBounds, Transform projector, bool useBaseNormal) {
|
||||||
|
Loading…
Reference in New Issue
Block a user