mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Use all cameras and rely on layers for culling
Also cleanup some stuff
This commit is contained in:
parent
1287e729eb
commit
d5038e19bc
@ -15,9 +15,9 @@ namespace ConformalDecals {
|
|||||||
// Target object data
|
// Target object data
|
||||||
public readonly Transform Target;
|
public readonly Transform Target;
|
||||||
|
|
||||||
private readonly Renderer _targetRenderer;
|
private readonly Renderer _targetRenderer;
|
||||||
private readonly Mesh _targetMesh;
|
private readonly Mesh _targetMesh;
|
||||||
private Boolean _projectionEnabled;
|
private bool _projectionEnabled;
|
||||||
|
|
||||||
// property block
|
// property block
|
||||||
public readonly MaterialPropertyBlock DecalMPB;
|
public readonly MaterialPropertyBlock DecalMPB;
|
||||||
@ -65,19 +65,11 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
public bool Render(Material decalMaterial) {
|
public bool Render(Material decalMaterial) {
|
||||||
if (_projectionEnabled) {
|
if (_projectionEnabled) {
|
||||||
if (HighLogic.LoadedSceneIsEditor) {
|
foreach (var camera in Camera.allCameras) {
|
||||||
var camera = EditorLogic.fetch.editorCamera;
|
|
||||||
Graphics.DrawMesh(_targetMesh, Target.worldToLocalMatrix, decalMaterial, 0, camera, 0, DecalMPB, ShadowCastingMode.Off, true);
|
Graphics.DrawMesh(_targetMesh, Target.worldToLocalMatrix, decalMaterial, 0, camera, 0, DecalMPB, ShadowCastingMode.Off, true);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HighLogic.LoadedSceneIsFlight) {
|
return true;
|
||||||
foreach (var camera in FlightCamera.fetch.cameras)
|
|
||||||
{
|
|
||||||
Graphics.DrawMesh(_targetMesh, Target.worldToLocalMatrix, decalMaterial, 0, camera, 0, DecalMPB, ShadowCastingMode.Off, true);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user