8 [SerializeField]
private bool grab =
true;
10 [SerializeField]
private Brush brush;
12 [SerializeField]
private GrabArea.GrabTextureWrapMode wrapMode = GrabArea.GrabTextureWrapMode.Repeat;
14 private RenderTexture t;
15 private RaycastHit hitInfo;
19 GUI.Box(
new Rect(0, 0, 300, 320),
"");
20 GUI.Box(
new Rect(0, 0, 300, 300),
"Grab Texture");
22 GUI.DrawTexture(
new Rect(0, 0, 300, 300), t);
23 grab = GUI.Toggle(
new Rect(0, 300, 300, 20), grab,
"Grab");
33 if (Input.GetMouseButtonDown(0))
35 var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
36 if (Physics.Raycast(ray, out hitInfo))
38 var d = hitInfo.transform.GetComponent<
InkCanvas>();
39 if (d !=
null && !grab) d.
Paint(brush, hitInfo);
43 hitInfo.transform.GetComponent<MeshRenderer>().sharedMaterial.mainTexture,
44 hitInfo.textureCoord, brush.
RotateAngle, wrapMode, t);
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 Paint(Brush brush, Vector3 worldPos, Func< PaintSet, bool > materialSelector=null, Camera renderCamera=null)
Paint processing that use world-space surface position.