public void SaveTexture(PaintableObject paintableObject) { brushCursor.SetActive(false); baseMaterial.mainTexture = paintableObject.GetCanvas(); canvasCam.targetTexture = paintableObject.GetBaseTex(); canvasCam.Render(); baseMaterial.mainTexture = paintableObject.GetBaseTex(); Transform brushContainer = paintableObject.GetBrushContainer(); Transform brushes = brushContainer.GetChild(0); Transform drips = brushContainer.GetChild(1); while (brushes.childCount > 0) { dotPool.FreeDot(brushes.GetChild(0).gameObject); } for (int i = 0; i < drips.childCount - 1; i++) { GameObject.Destroy(drips.GetChild(i).gameObject); } ShowCursor(); }
public void RenderCanvas(PaintableObject paintableObject, bool withCursor) { brushCursor.SetActive(false); Transform brushContainer = paintableObject.GetBrushContainer(); brushContainer.gameObject.SetActive(true); baseMaterial.mainTexture = paintableObject.GetBaseTex(); canvasCam.targetTexture = paintableObject.GetCanvas(); canvasCam.Render(); brushContainer.gameObject.SetActive(false); if (withCursor) { brushCursor.SetActive(true); baseMaterial.mainTexture = blackTex; canvasCam.targetTexture = paintableObject.m_cursorTex; canvasCam.Render(); } else { baseMaterial.mainTexture = blackTex; canvasCam.targetTexture = paintableObject.m_cursorTex; canvasCam.Render(); } }