Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f74221bf75 | ||
|
|
3a705732d1 | ||
|
|
804bfb96bd |
Binary file not shown.
BIN
Assets/uDesktopDuplication/Examples/Prefabs/Monitor Plane.prefab
Normal file
BIN
Assets/uDesktopDuplication/Examples/Prefabs/Monitor Plane.prefab
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42d6b6dbae38a384e882c2c907915139
|
||||
timeCreated: 1478889784
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,6 +9,10 @@ public class MultipleMonitorCreator : MonoBehaviour
|
||||
bool hasMonitorUnsupportStateChecked = false;
|
||||
float removeWaitTimer_ = 0f;
|
||||
|
||||
public enum MeshForwardDirection { Y, Z }
|
||||
[Tooltip("Please specify the upper vector direction of the mesh (e.g. Plane's upper direction is Y.)")]
|
||||
public MeshForwardDirection meshForwardDirection = MeshForwardDirection.Z;
|
||||
|
||||
public class MonitorInfo
|
||||
{
|
||||
public GameObject gameObject { get; set; }
|
||||
@@ -88,7 +92,11 @@ public class MultipleMonitorCreator : MonoBehaviour
|
||||
var monitor = texture.monitor;
|
||||
|
||||
// Set width / height
|
||||
go.transform.localScale = new Vector3(monitor.widthMeter, go.transform.localScale.y, monitor.heightMeter);
|
||||
if (meshForwardDirection == MeshForwardDirection.Y) {
|
||||
go.transform.localScale = new Vector3(monitor.widthMeter, go.transform.localScale.y, monitor.heightMeter);
|
||||
} else {
|
||||
go.transform.localScale = new Vector3(monitor.widthMeter, monitor.heightMeter, go.transform.localScale.z);
|
||||
}
|
||||
|
||||
// Set parent as this object
|
||||
go.transform.SetParent(transform);
|
||||
|
||||
@@ -36,9 +36,13 @@ public class MultipleMonitorRoundLayouter : MultipleMonitorLayouter
|
||||
uddTex.transform.localRotation = Quaternion.AngleAxis(angle * Mathf.Rad2Deg, Vector3.up) * info.originalRotation;
|
||||
angle += (width * 0.5f + margin) / radius;
|
||||
|
||||
uddTex.bend = uDesktopDuplication.Texture.Bend.Y;
|
||||
if (creator_.meshForwardDirection == MultipleMonitorCreator.MeshForwardDirection.Y) {
|
||||
uddTex.bend = uDesktopDuplication.Texture.Bend.Y;
|
||||
} else {
|
||||
uddTex.bend = uDesktopDuplication.Texture.Bend.Z;
|
||||
}
|
||||
uddTex.radius = radius;
|
||||
uddTex.width = uddTex.monitor.widthMeter;
|
||||
uddTex.width = uddTex.transform.localScale.x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9
Assets/uDesktopDuplication/Models.meta
Normal file
9
Assets/uDesktopDuplication/Models.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75494e992a22ea44d9b614d7fd3dc235
|
||||
folderAsset: yes
|
||||
timeCreated: 1478887431
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/uDesktopDuplication/Models/uDD_Board.fbx
Normal file
BIN
Assets/uDesktopDuplication/Models/uDD_Board.fbx
Normal file
Binary file not shown.
78
Assets/uDesktopDuplication/Models/uDD_Board.fbx.meta
Normal file
78
Assets/uDesktopDuplication/Models/uDD_Board.fbx.meta
Normal file
@@ -0,0 +1,78 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6b30b913257fee4d8246bf7a2620fcd
|
||||
timeCreated: 1478887431
|
||||
licenseType: Pro
|
||||
ModelImporter:
|
||||
serializedVersion: 19
|
||||
fileIDToRecycleName:
|
||||
100000: //RootNode
|
||||
400000: //RootNode
|
||||
2300000: //RootNode
|
||||
3300000: //RootNode
|
||||
4300000: pCube1
|
||||
4300002: uDD_Board
|
||||
9500000: //RootNode
|
||||
materials:
|
||||
importMaterials: 0
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 0.1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 2
|
||||
importAnimation: 0
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 0
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -13,8 +13,9 @@ public class Texture : MonoBehaviour
|
||||
set
|
||||
{
|
||||
monitor_ = value;
|
||||
material = GetComponent<Renderer>().material;
|
||||
material = GetComponent<Renderer>().material; // clone
|
||||
material.mainTexture = monitor_.texture;
|
||||
material.SetFloat("_Width", transform.localScale.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,4 +92,19 @@ inline fixed4 uddGetScreenTextureWithCursor(float2 uv)
|
||||
return color;
|
||||
}
|
||||
|
||||
inline void uddBendVertex(inout float4 v, half radius, half width)
|
||||
{
|
||||
#if !defined(_BEND_OFF)
|
||||
half angle = width * v.x / radius;
|
||||
#ifdef _BEND_Y
|
||||
radius -= v.y;
|
||||
v.y += radius * (1 - cos(angle));
|
||||
#elif _BEND_Z
|
||||
radius -= v.z;
|
||||
v.z += radius * (1 - cos(angle));
|
||||
#endif
|
||||
v.x = radius * sin(angle) / width;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,7 @@ Properties
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_CursorTex ("Cursor Texture", 2D) = "white" {}
|
||||
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
|
||||
[PowerSlider(10.0)]_Radius ("Radius", Range(1, 100)) = 30
|
||||
[PowerSlider(10.0)] _Radius("Radius", Range(1, 100)) = 30
|
||||
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
||||
}
|
||||
|
||||
@@ -28,15 +28,7 @@ half _Width;
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
#if defined(_BEND_Z) || defined(_BEND_Y)
|
||||
half a = _Width * v.vertex.x / _Radius;
|
||||
v.vertex.x = _Radius * sin(a) / _Width;
|
||||
#ifdef _BEND_Y
|
||||
v.vertex.y += _Radius * (1 - cos(a));
|
||||
#elif _BEND_Z
|
||||
v.vertex.z += _Radius * (1 - cos(a));
|
||||
#endif
|
||||
#endif
|
||||
uddBendVertex(v.vertex, _Radius, _Width);
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
return o;
|
||||
|
||||
@@ -6,6 +6,9 @@ Properties
|
||||
_Color ("Color", Color) = (1, 1, 1, 1)
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_Mask ("Mask", Range(0, 1)) = 0.1
|
||||
_CursorTex ("Cursor Texture", 2D) = "white" {}
|
||||
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
|
||||
[PowerSlider(10.0)] _Radius("Radius", Range(1, 100)) = 30
|
||||
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
||||
}
|
||||
|
||||
@@ -23,10 +26,13 @@ CGINCLUDE
|
||||
#include "./uDD_Common.cginc"
|
||||
|
||||
fixed _Mask;
|
||||
half _Radius;
|
||||
half _Width;
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
uddBendVertex(v.vertex, _Radius, _Width);
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
return o;
|
||||
@@ -51,6 +57,7 @@ Pass
|
||||
#pragma multi_compile ___ ROTATE90 ROTATE180 ROTATE270
|
||||
#pragma multi_compile ___ USE_BEND
|
||||
#pragma multi_compile ___ USE_CLIP
|
||||
#pragma multi_compile _BEND_OFF _BEND_Y _BEND_Z
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ Properties
|
||||
{
|
||||
_Color ("Color", Color) = (1, 1, 1, 1)
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_CursorTex ("Cursor Texture", 2D) = "white" {}
|
||||
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
|
||||
[PowerSlider(10.0)] _Radius("Radius", Range(1, 100)) = 30
|
||||
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
||||
}
|
||||
|
||||
@@ -21,9 +24,13 @@ CGINCLUDE
|
||||
|
||||
#include "./uDD_Common.cginc"
|
||||
|
||||
half _Radius;
|
||||
half _Width;
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
uddBendVertex(v.vertex, _Radius, _Width);
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
return o;
|
||||
@@ -46,6 +53,7 @@ Pass
|
||||
#pragma multi_compile ___ ROTATE90 ROTATE180 ROTATE270
|
||||
#pragma multi_compile ___ USE_BEND
|
||||
#pragma multi_compile ___ USE_CLIP
|
||||
#pragma multi_compile _BEND_OFF _BEND_Y _BEND_Z
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user