mirror of
https://github.com/mixandjam/Splatoon-Ink.git
synced 2026-03-21 17:25:34 -05:00
textures initialization moved to paint manager
This commit is contained in:
parent
bef13dacfe
commit
da5d9c79d4
|
|
@ -19,13 +19,28 @@ public class PaintManager : Singleton<PaintManager>{
|
|||
|
||||
CommandBuffer command;
|
||||
|
||||
void Start(){
|
||||
public override void Awake(){
|
||||
base.Awake();
|
||||
|
||||
paintMaterial = new Material(texturePaint);
|
||||
extendMaterial = new Material(extendIslands);
|
||||
command = new CommandBuffer();
|
||||
command.name = "CommmandBuffer - " + gameObject.name;
|
||||
}
|
||||
|
||||
public void initTextures(Paintable paintable){
|
||||
RenderTexture mask = paintable.getMask();
|
||||
RenderTexture extend = paintable.getExtend();
|
||||
RenderTexture support = paintable.getSupport();
|
||||
|
||||
command.SetRenderTarget(mask);
|
||||
command.SetRenderTarget(extend);
|
||||
command.SetRenderTarget(support);
|
||||
|
||||
Graphics.ExecuteCommandBuffer(command);
|
||||
command.Clear();
|
||||
}
|
||||
|
||||
public void paint(Paintable paintable, Vector3 pos, float radius = 1f, float hardness = .5f, float strength = .5f, Color? color = null){
|
||||
|
||||
RenderTexture mask = paintable.getMask();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
public class Paintable : MonoBehaviour {
|
||||
const int TEXTURE_SIZE = 1024;
|
||||
|
|
@ -29,12 +28,7 @@ public class Paintable : MonoBehaviour {
|
|||
rend = GetComponent<Renderer>();
|
||||
rend.material.SetTexture(maskTextureID, extendIslandsRenderTexture);
|
||||
|
||||
CommandBuffer command = new CommandBuffer();
|
||||
command.name = "CommandBuffer - " + gameObject.name;
|
||||
command.SetRenderTarget(maskRenderTexture);
|
||||
command.SetRenderTarget(extendIslandsRenderTexture);
|
||||
command.SetRenderTarget(supportTexture);
|
||||
Graphics.ExecuteCommandBuffer(command);
|
||||
PaintManager.instance.initTextures(this);
|
||||
}
|
||||
|
||||
void OnDisable(){
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user