Skip to content

Commit

Permalink
Minor Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
bigorangemachine committed Oct 6, 2014
1 parent 0b63244 commit d6411ca
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/KRSVesselShot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class KRSVesselShot
{"bgR",1f},{"bgG",1f},{"bgB",1f},{"bgA",1f},//RGBA
{"bgR_",0f},{"bgG_",0.07f},{"bgB_",0.11f},{"bgA_",1f}//RGBA defaults //00406E 0,64,110 -> reduced due to color adjust shader
};
public Dictionary<string, bool> uiBoolVals = new Dictionary<string, bool> {
{"canPreview",true},{"saveTextureEvent",false}
};

private Camera[] cameras;
private RenderTexture rt;
//private int maxWidth = 4096;
Expand Down Expand Up @@ -319,19 +323,23 @@ public void GenTexture(Vector3 direction, int imageWidth = -1, int imageHeight =
fileWidth = (int)Math.Floor(imageWidth * (uiFloatVals["imgPercent"] >= 1 ? uiFloatVals["imgPercent"] : 1f));
fileHeight = (int)Math.Floor(imageHeight * (uiFloatVals["imgPercent"] >= 1 ? uiFloatVals["imgPercent"] : 1f));
}
this.rt = RenderTexture.GetTemporary(fileWidth, fileHeight, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
//this.rt = RenderTexture.GetTemporary(imageWidth, imageHeight, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
this.Camera.targetTexture = this.rt;
this.Camera.depthTextureMode = DepthTextureMode.DepthNormals;
this.Camera.Render();
this.Camera.targetTexture = null;
//Graphics.Blit(this.rt, this.rt, MaterialColorAdjust.Material);
//Graphics.Blit(this.rt, this.rt, MaterialEdgeDetect.Material);
foreach (var fx in Effects)

if (uiBoolVals["canPreview"] || uiBoolVals["saveTextureEvent"])
{
if (fx.Value.Enabled)
this.rt = RenderTexture.GetTemporary(fileWidth, fileHeight, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
//this.rt = RenderTexture.GetTemporary(imageWidth, imageHeight, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
this.Camera.targetTexture = this.rt;
this.Camera.depthTextureMode = DepthTextureMode.DepthNormals;
this.Camera.Render();
this.Camera.targetTexture = null;
//Graphics.Blit(this.rt, this.rt, MaterialColorAdjust.Material);
//Graphics.Blit(this.rt, this.rt, MaterialEdgeDetect.Material);
foreach (var fx in Effects)
{
Graphics.Blit(this.rt, this.rt, fx.Value.Material);
if (fx.Value.Enabled)
{
Graphics.Blit(this.rt, this.rt, fx.Value.Material);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/KRSVesselShotUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ private void GUIButtons()

if (GUILayout.Button("Screenshot"))
{
control.uiBoolVals["saveTextureEvent"] = true;
this.control.Update();
this.control.Execute();
}
Expand Down Expand Up @@ -384,6 +385,9 @@ private void GUITabShader(string name)

private void GUITabView()
{
GUILayout.BeginVertical();
control.uiBoolVals["canPreview"] = GUILayout.Toggle(control.uiBoolVals["canPreview"], "Auto-Preview", GUILayout.ExpandWidth(true));
GUILayout.EndHorizontal();
var r = GUILayoutUtility.GetRect(0, this.windowSize.width, 0, this.windowSize.height);
if (Event.current.type == EventType.Repaint)
{
Expand Down

0 comments on commit d6411ca

Please sign in to comment.