-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Marker Menu example in the Toolkit + accordingly readme change.
- Loading branch information
1 parent
a8a0546
commit 5b72c9b
Showing
62 changed files
with
4,791 additions
and
101 deletions.
There are no files selected for viewing
3,188 changes: 3,188 additions & 0 deletions
3,188
...Toolkit/Assets/LogitechVRToolkit/Examples/ExampleInteractions/11_Example_MarkerMenu.unity
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...it/Assets/LogitechVRToolkit/Examples/ExampleInteractions/11_Example_MarkerMenu.unity.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...lkit/Examples/InteractionResources/DrawingProperties/Square ShaderDrawingProperties.asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
%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: a3a2a09c03c0b5d42a3f59c8a89129ce, type: 3} | ||
m_Name: Square ShaderDrawingProperties | ||
m_EditorClassIdentifier: | ||
Offset: -0.005 | ||
Spacing: 0.5 | ||
MinWidth: 0 | ||
ComputeShaderRef: {fileID: 7200000, guid: 4c1fe886ed1c29740b9a72a581d32e00, type: 3} | ||
TextureDimension: {x: 3840, y: 3840} | ||
UndoHistorySize: 24 |
8 changes: 8 additions & 0 deletions
8
...Examples/InteractionResources/DrawingProperties/Square ShaderDrawingProperties.asset.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...kit/Examples/InteractionResources/Resources/ShaderDrawing/ComputeShaderNewDrawing.compute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Each #kernel tells which function to compile; you can have many kernels. | ||
#pragma kernel CSMain | ||
#pragma kernel SaveFrame | ||
#pragma kernel WriteFrame | ||
#pragma kernel EraseAll | ||
|
||
// Variables. | ||
RWTexture2D<float4> Result; | ||
float Range; | ||
float2 TextureDimension; | ||
int arrayLength; | ||
float4 penColor; | ||
float4 penPosition; | ||
float4 previousPenPosition; | ||
float hardness; | ||
float brushSize; | ||
float previousBrushSize; | ||
bool isErasing; | ||
|
||
RWTexture2DArray<float4> UndoTexture; | ||
Texture2D<float4> UndoTextures[100]; | ||
|
||
[numthreads(32, 32, 1)] | ||
void CSMain (uint3 id : SV_DispatchThreadID) | ||
{ | ||
float distanceFromInk = distance(penPosition, id.xy); | ||
float brushDrawing = step(distanceFromInk, brushSize); | ||
|
||
// Color from the stylus that is going to be blended. | ||
float4 sourceColor = penColor; | ||
// Destination color, basically the canvas. | ||
float4 destinationColor = Result[id.xy]; | ||
// Final color. | ||
float4 outColor = penColor; | ||
|
||
// Alpha blending as per https://en.wikipedia.org/wiki/Alpha_compositing#Composing_alpha_blending_with_gamma_correction. | ||
outColor.a = sourceColor.a + destinationColor.a * (1 - sourceColor.a); | ||
outColor.rgb = sourceColor.rgb + destinationColor.rgb*(1 - sourceColor.a); | ||
|
||
// Do not blend if drawing is on the same color. | ||
float allowBlending = step(0.01, distance(destinationColor, sourceColor)); | ||
outColor = allowBlending * outColor + step(allowBlending, 0) * penColor; | ||
|
||
Result[id.xy] = brushDrawing * outColor + step(brushDrawing, 0) * Result[id.xy]; | ||
} | ||
|
||
int currentDepth; | ||
[numthreads(32, 32, 1)] | ||
void SaveFrame (uint3 id : SV_DispatchThreadID) | ||
{ | ||
UndoTexture[uint3(id.x, id.y, currentDepth)] = Result[id.xy]; | ||
} | ||
|
||
[numthreads(32, 32, 1)] | ||
void WriteFrame (uint3 id : SV_DispatchThreadID) | ||
{ | ||
Result[id.xy] = UndoTexture[uint3(id.x, id.y, currentDepth)]; | ||
} | ||
|
||
[numthreads(32, 32, 1)] | ||
void EraseAll (uint3 id : SV_DispatchThreadID) | ||
{ | ||
Result[id.xy] = float4(0, 0, 0, 0); | ||
} |
8 changes: 8 additions & 0 deletions
8
...xamples/InteractionResources/Resources/ShaderDrawing/ComputeShaderNewDrawing.compute.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...s/Toolkit/Assets/LogitechVRToolkit/Examples/InteractionResources/Textures/MarkerMenu.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+1.18 KB
...VRToolkit/Examples/InteractionResources/Textures/MarkerMenu/AppearsDisapear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions
86
...itechVRToolkit/Examples/InteractionResources/Textures/MarkerMenu/AppearsDisapear.png.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+3.11 KB
...hVRToolkit/Examples/InteractionResources/Textures/MarkerMenu/ColorSelection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.