8 [SerializeField]
private Brush brush;
10 [SerializeField]
private GameObject camPref;
12 private RenderTexture rt;
19 rt =
new RenderTexture(Screen.width, Screen.height, 16, RenderTextureFormat.ARGB32);
25 if (GUILayout.Button(
"Reset"))
27 if (paintObject !=
null)
36 if (cam ==
null && Input.GetMouseButtonDown(0))
38 var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
40 if (Physics.Raycast(ray, out hitInfo))
42 paintObject = hitInfo.transform.GetComponent<
InkCanvas>();
43 if (paintObject !=
null)
45 uv = hitInfo.textureCoord;
46 var camObj = Instantiate(camPref, hitInfo.point, Quaternion.LookRotation(hitInfo.normal),
48 cam = camObj.GetComponent<Camera>();
49 cam.targetTexture = rt;
50 camObj.SetActive(
true);
58 GrabArea.GrabTextureWrapMode.Clip, buf);
59 ReverseUV.Horizontal(buf, buf);
62 if (paintObject !=
null)
64 RenderTexture.ReleaseTemporary(buf);
Class managing brush information.
float RotateAngle
Rotate angle of the brush.
float Scale
The size of the brush. It takes a range from 0 to 1.
ColorBlendType ColorBlending
Color synthesis method.
ColorBlendType
Color synthesis method.
Texture BrushTexture
Brush texture.
Texture paint to canvas. To set the per-material.
bool PaintUVDirect(Brush brush, Vector2 uv, Func< PaintSet, bool > materialSelector=null)
Paint processing that UV coordinates to the specified.
void ResetPaint()
To reset the paint.