Skip to content

Commit

Permalink
Added Paint Brush interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ChichoRD committed Aug 9, 2023
1 parent 8aa0870 commit 3d10fd8
Show file tree
Hide file tree
Showing 46 changed files with 5,503 additions and 6,226 deletions.
7 changes: 5 additions & 2 deletions Paint System.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
"rootNamespace": "",
"references": [
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:9c424c5baf190bc44b4c5623793371cd"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"defineConstraints": [
"REQUIRE_INTERFACE_ATTRIBUTE"
],
"versionDefines": [],
"noEngineReferences": false
}
6 changes: 4 additions & 2 deletions Samples/Collections/Multicolor Collection.asset
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 134cc295fd17cce47b634ca363f4ccda, type: 3}
m_Script: {fileID: 0}
m_Name: Multicolor Collection
m_EditorClassIdentifier:
<PaintSettings>k__BackingField:
- {fileID: 11400000, guid: 732b6be3cb0f0fe48b917c9921938a4f, type: 2}
- {fileID: 11400000, guid: 5c176db9b78dec24db9b510f915961a1, type: 2}
- {fileID: 11400000, guid: 732b6be3cb0f0fe48b917c9921938a4f, type: 2}
- {fileID: 11400000, guid: 5b3a7dff3680cef45981d29a87bdf35d, type: 2}
- {fileID: 11400000, guid: 2c2c264986240e647ab432312c78a3a4, type: 2}
- {fileID: 11400000, guid: 64c41a4d74753f147a7ea26288957578, type: 2}
<UseRandomRotation>k__BackingField: 0
<UseRandomTexture>k__BackingField: 0
<UseRandomSettings>k__BackingField: 0
<SelectedPaintSettingsIndex>k__BackingField: 0
6 changes: 3 additions & 3 deletions Samples/Colors/Blue Paint.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ MonoBehaviour:
<BrushStrength>k__BackingField: 0.5
<PaintColor>k__BackingField: {r: 0.04955495, g: 0.22035761, b: 0.8207547, a: 1}
<PaintMetallic>k__BackingField: 0.5
<PaintSmoothness>k__BackingField: 1
<PaintSmoothness>k__BackingField: 0.5
<PaintTexture>k__BackingField: {fileID: 2800000, guid: db80ee5d352c3014c85fca9f808d539c,
type: 3}
<PaintTextureRotation>k__BackingField: {x: 0, y: 0, z: 0}
<PaintTextureScale>k__BackingField: {x: 0.5, y: 0.5}
<PaintTextureOffset>k__BackingField: {x: -0.75, y: -0.75}
<PaintTextureScale>k__BackingField: {x: 0.14285715, y: 0.14285715}
<PaintTextureOffset>k__BackingField: {x: -0.5, y: -0.5}
58 changes: 58 additions & 0 deletions Samples/Colors/Multichannel Paint Brush Object.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62c952240969ade458964f3bd738407a, type: 3}
m_Name: Multichannel Paint Brush Object
m_EditorClassIdentifier:
<PaintBrushes>k__BackingField:
- rid: 4411147410609274888
- rid: 4411147410609274890
references:
version: 2
RefIds:
- rid: 4411147410609274888
type: {class: TexturedPaintBrushData, ns: PaintSystem, asm: PaintSystem}
data:
<PaintBrushData>k__BackingField:
rid: 4411147410609274889
<PaintTexture>k__BackingField: {fileID: 2800000, guid: db80ee5d352c3014c85fca9f808d539c,
type: 3}
<PaintTextureRotation>k__BackingField: {x: 0, y: 0, z: 0}
<PaintTextureScale>k__BackingField: {x: 0.16666667, y: 0.16666667}
<PaintTextureOffset>k__BackingField: {x: 0.5, y: 0.5}
- rid: 4411147410609274889
type: {class: PaintBrushData, ns: PaintSystem, asm: PaintSystem}
data:
<BrushRadius>k__BackingField: 1
<BrushHardness>k__BackingField: 0
<BrushStrength>k__BackingField: 0.5
<PaintColor>k__BackingField: {r: 0.34582543, g: 0.16945527, b: 0.8018868,
a: 1}
- rid: 4411147410609274890
type: {class: TexturedPaintBrushData, ns: PaintSystem, asm: PaintSystem}
data:
<PaintBrushData>k__BackingField:
rid: 4411147410609274891
<PaintTexture>k__BackingField: {fileID: 2800000, guid: db80ee5d352c3014c85fca9f808d539c,
type: 3}
<PaintTextureRotation>k__BackingField: {x: 0, y: 0, z: 0}
<PaintTextureScale>k__BackingField: {x: 0.16666666, y: 0.16666666}
<PaintTextureOffset>k__BackingField: {x: 0.5, y: 0.5}
- rid: 4411147410609274891
type: {class: PBRPaintBrushData, ns: PaintSystem, asm: PaintSystem}
data:
<PaintBrushData>k__BackingField:
<BrushRadius>k__BackingField: 1
<BrushHardness>k__BackingField: 0
<BrushStrength>k__BackingField: 0.5
<PaintColor>k__BackingField: {r: 1, g: 1, b: 1, a: 1}
<PaintMetallic>k__BackingField: 0.5
<PaintSmoothness>k__BackingField: 0.75

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions Samples/Materials/Paintable Floor Sample.mat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Paintable Floor Sample
m_Shader: {fileID: -6465566751694194690, guid: 3f810dad87d4a484dbd041790a090c69,
m_Shader: {fileID: -6465566751694194690, guid: 5b29e2b6e3886df438f0f986ed32632f,
type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
Expand All @@ -42,6 +42,10 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -74,6 +78,18 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicSmoothnessMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicSmoothnessTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
Expand Down Expand Up @@ -128,11 +144,14 @@ Material:
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _NormalStrength: 1
- _OcclusionStrength: 1
- _PaintNoiseNormalStrength: 0.5
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ShapeNoiseScale: 10
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
Expand All @@ -149,6 +168,7 @@ Material:
- Vector2_55edcb19ba1d459dbb3c027e66abbc1e: {r: 1, g: 1, b: 0, a: 0}
- Vector2_e97cb9b7b5564bc9857e7669e2d0b82f: {r: 1, g: 1, b: 0, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseMapColor: {r: 1, g: 1, b: 1, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d323f44e3def4f442a666ea29267b2e6, type: 3}
m_Name: Sample Paint Manager Object
m_Script: {fileID: 11500000, guid: a6274df6edd5eb14ea3bfda0b8c8d4e3, type: 3}
m_Name: Paint Requester Object
m_EditorClassIdentifier:
8 changes: 8 additions & 0 deletions Samples/Paint Requester Object.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Scripts/Paint Brush.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Scripts/Paint Brush/Data.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Scripts/Paint Brush/Data/Interfaces.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Scripts/Paint Brush/Data/Interfaces/IPaintBrush.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using UnityEngine;

namespace PaintSystem
{
public interface IPaintBrush
{
float BrushRadius { get; }
float BrushHardness { get; }
float BrushStrength { get; }
Color PaintColor { get; }
PaintTarget PaintTarget { get; }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Scripts/Paint Brush/Data/Interfaces/ITexturedPaintBrush.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UnityEngine;

namespace PaintSystem
{
public interface ITexturedPaintBrush : IPaintBrush
{
Texture2D PaintTexture { get; }
Vector3 PaintTextureRotation { get; }
Vector2 PaintTextureScale { get; }
Vector2 PaintTextureOffset { get; }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Scripts/Paint Brush/Data/PBRPaintBrushData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using UnityEngine;

namespace PaintSystem
{
[Serializable]
public struct PBRPaintBrushData : IPaintBrush
{
public PBRPaintBrushData(PaintBrushData paintBrushData) : this()
{
PaintBrushData = paintBrushData;
}

public static readonly PBRPaintBrushData Default = new PBRPaintBrushData()
{
PaintBrushData = PaintBrushData.Default,
PaintMetallic = 0.5f,
PaintSmoothness = 0.5f
};

[field: SerializeField] public PaintBrushData PaintBrushData { get; set; }
[field: SerializeField][field: Range(0f, 1f)] public float PaintMetallic { get; set; }
[field: SerializeField][field: Range(0f, 1f)] public float PaintSmoothness { get; set; }

public readonly float BrushRadius => PaintBrushData.BrushRadius;
public readonly float BrushHardness => PaintBrushData.BrushHardness;
public readonly float BrushStrength => PaintBrushData.BrushStrength;

public readonly Color PaintColor => new Color(PaintMetallic, PaintSmoothness, 0.0f, 1.0f);

public readonly PaintTarget PaintTarget => PaintTarget.MetallicSmoothness;
}

}
11 changes: 11 additions & 0 deletions Scripts/Paint Brush/Data/PBRPaintBrushData.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Scripts/Paint Brush/Data/PaintBrushData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using UnityEngine;

namespace PaintSystem
{
[Serializable]
public struct PaintBrushData : IPaintBrush
{
public static readonly PaintBrushData Default = new PaintBrushData()
{
BrushRadius = 1f,
BrushHardness = 0.5f,
BrushStrength = 0.5f,
PaintColor = Color.white
};

[field: SerializeField][field: Min(0)] public float BrushRadius { get; set; }
[field: SerializeField][field: Range(0f, 1f)] public float BrushHardness { get; set; }
[field: SerializeField][field: Range(0f, 1f)] public float BrushStrength { get; set; }
[field: SerializeField] public Color PaintColor { get; set; }

public readonly PaintTarget PaintTarget => PaintTarget.Albedo;
}

}
11 changes: 11 additions & 0 deletions Scripts/Paint Brush/Data/PaintBrushData.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Scripts/Paint Brush/Data/PaintTarget.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace PaintSystem
{
public enum PaintTarget
{
Albedo,
MetallicSmoothness,
}
}
11 changes: 11 additions & 0 deletions Scripts/Paint Brush/Data/PaintTarget.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3d10fd8

Please sign in to comment.