Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-065
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-065
2020-065
Commits
6a0cd565
Commit
6a0cd565
authored
Nov 06, 2020
by
Fonseka W.M.D.R
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update
parent
47a51cfd
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1279 additions
and
0 deletions
+1279
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta
...60926/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta
+10
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta
...60926/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta
+10
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/Editor.meta
...ssets/GoogleARCore/SDK/InstantPreview/Scripts/Editor.meta
+8
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/Editor/InstantPreviewBugReport.cs
.../InstantPreview/Scripts/Editor/InstantPreviewBugReport.cs
+269
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/Editor/InstantPreviewBugReport.cs.meta
...antPreview/Scripts/Editor/InstantPreviewBugReport.cs.meta
+11
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs
...eARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs
+247
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta
...re/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta
+13
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs
...RCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs
+639
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta
.../SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta
+13
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs
...InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs
+46
-0
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta
...ntPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta
+13
-0
No files found.
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Plugins.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: ede998a9371e74aa6a759743f41b3eb6
folderAsset: yes
timeCreated: 1513969093
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: a10b012db03ac404a87dcb0519846527
folderAsset: yes
timeCreated: 1513969093
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/Editor.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: 623df6c5972d64e30ad049b928187b23
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/Editor/InstantPreviewBugReport.cs
0 → 100644
View file @
6a0cd565
This diff is collapsed.
Click to expand it.
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/Editor/InstantPreviewBugReport.cs.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: 215dd5ac015e34be8ab43c96f53a2bcd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs
0 → 100644
View file @
6a0cd565
//-----------------------------------------------------------------------
// <copyright file="InstantPreviewInput.cs" company="Google">
//
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
//-----------------------------------------------------------------------
namespace
GoogleARCore
{
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics.CodeAnalysis
;
using
System.Runtime.InteropServices
;
using
GoogleARCoreInternal
;
using
UnityEngine
;
/// <summary>
/// Helper class that provides touch input in lieu of Input.GetTouch when
/// running the Unity Editor.
/// </summary>
public
static
class
InstantPreviewInput
{
private
static
Touch
[]
s_Touches
=
new
Touch
[
0
];
private
static
List
<
Touch
>
s_TouchList
=
new
List
<
Touch
>();
/// <summary>
/// Gets the inputString from Instant Preview since the last update.
/// </summary>
[
SuppressMessage
(
"UnityRules.UnityStyleRules"
,
"US1000:FieldsMustBeUpperCamelCase"
,
Justification
=
"Overridden field."
)]
public
static
string
inputString
{
get
{
return
Input
.
inputString
;
}
}
/// <summary>
/// Gets the available touch inputs from Instant Preview since the last
/// update.
/// </summary>
[
SuppressMessage
(
"UnityRules.UnityStyleRules"
,
"US1000:FieldsMustBeUpperCamelCase"
,
Justification
=
"Overridden field."
)]
public
static
Touch
[]
touches
{
get
{
NativeApi
.
UnityGotTouches
();
return
s_Touches
;
}
}
/// <summary>
/// Gets the number of touches available from Instant preview since the
/// last update.
/// </summary>
[
SuppressMessage
(
"UnityRules.UnityStyleRules"
,
"US1000:FieldsMustBeUpperCamelCase"
,
Justification
=
"Overridden field."
)]
public
static
int
touchCount
{
get
{
return
touches
.
Length
;
}
}
/// <summary>
/// Gets return value of Input.mousePosition.
/// </summary>
[
SuppressMessage
(
"UnityRules.UnityStyleRules"
,
"US1000:FieldsMustBeUpperCamelCase"
,
Justification
=
"Overridden field."
)]
public
static
Vector3
mousePosition
{
get
{
return
Input
.
mousePosition
;
}
}
/// <summary>
/// Gets a value indicating whether a mouse device is detected.
/// </summary>
[
SuppressMessage
(
"UnityRules.UnityStyleRules"
,
"US1000:FieldsMustBeUpperCamelCase"
,
Justification
=
"Overridden field."
)]
public
static
bool
mousePresent
{
get
{
return
Input
.
mousePresent
;
}
}
/// <summary>
/// Gets a specific touch input from Instant Preview by index.
/// </summary>
/// <param name="index">Index of touch input to get.</param>
/// <returns>Touch data.</returns>
public
static
Touch
GetTouch
(
int
index
)
{
return
touches
[
index
];
}
/// <summary>
/// Passthrough function to Input.GetKey.
/// </summary>
/// <param name="keyCode">Key parameter to pass to Input.GetKey.</param>
/// <returns>Key state returned from Input.GetKey.</returns>
public
static
bool
GetKey
(
KeyCode
keyCode
)
{
return
Input
.
GetKey
(
keyCode
);
}
/// <summary>
/// Passthrough function to Input.GetMouseButton.
/// </summary>
/// <param name="button">Button index.</param>
/// <returns>Return value of Input.GetMouseButton.</returns>
public
static
bool
GetMouseButton
(
int
button
)
{
return
Input
.
GetMouseButton
(
button
);
}
/// <summary>
/// Passthrough function to Input.GetMouseButtonDown.
/// </summary>
/// <param name="button">Button index.</param>
/// <returns>Return value of Input.GetMouseButtonDown.</returns>
public
static
bool
GetMouseButtonDown
(
int
button
)
{
return
Input
.
GetMouseButtonDown
(
button
);
}
/// <summary>
/// Passthrough function to Input.GetMouseButtonUp.
/// </summary>
/// <param name="button">Button index.</param>
/// <returns>Return value of Input.GetMouseButtonUp.</returns>
public
static
bool
GetMouseButtonUp
(
int
button
)
{
return
Input
.
GetMouseButtonUp
(
button
);
}
/// <summary>
/// Refreshes touch inputs from Instant Preview to reflect the state
/// since the last time Update was called.
/// </summary>
public
static
void
Update
()
{
if
(!
Application
.
isEditor
)
{
return
;
}
// Removes ended touches, and converts moves to stationary.
for
(
int
i
=
0
;
i
<
s_TouchList
.
Count
;
++
i
)
{
if
(
s_TouchList
[
i
].
phase
==
TouchPhase
.
Ended
)
{
s_TouchList
.
RemoveAt
(
i
);
--
i
;
continue
;
}
var
curTouch
=
s_TouchList
[
i
];
curTouch
.
phase
=
TouchPhase
.
Stationary
;
curTouch
.
deltaPosition
=
Vector2
.
zero
;
s_TouchList
[
i
]
=
curTouch
;
}
// Updates touches.
IntPtr
nativeTouchesPtr
;
int
nativeTouchCount
;
NativeApi
.
GetTouches
(
out
nativeTouchesPtr
,
out
nativeTouchCount
);
var
structSize
=
Marshal
.
SizeOf
(
typeof
(
NativeTouch
));
for
(
var
i
=
0
;
i
<
nativeTouchCount
;
++
i
)
{
var
source
=
new
IntPtr
(
nativeTouchesPtr
.
ToInt64
()
+
(
i
*
structSize
));
NativeTouch
nativeTouch
=
(
NativeTouch
)
Marshal
.
PtrToStructure
(
source
,
typeof
(
NativeTouch
));
var
newTouch
=
new
Touch
()
{
fingerId
=
nativeTouch
.
Id
,
phase
=
nativeTouch
.
Phase
,
pressure
=
nativeTouch
.
Pressure
,
// NativeTouch values are normalized and must be converted to screen
// coordinates.
// Note that the Unity's screen coordinate (0, 0) starts from bottom left.
position
=
new
Vector2
(
Screen
.
width
*
nativeTouch
.
X
,
Screen
.
height
*
(
1f
-
nativeTouch
.
Y
)),
};
var
index
=
s_TouchList
.
FindIndex
(
touch
=>
touch
.
fingerId
==
newTouch
.
fingerId
);
// Adds touch if not found, otherwise updates it.
if
(
index
<
0
)
{
s_TouchList
.
Add
(
newTouch
);
}
else
{
var
prevTouch
=
s_TouchList
[
index
];
newTouch
.
deltaPosition
+=
newTouch
.
position
-
prevTouch
.
position
;
s_TouchList
[
index
]
=
newTouch
;
}
}
s_Touches
=
s_TouchList
.
ToArray
();
}
private
struct
NativeTouch
{
#pragma warning disable 649
public
TouchPhase
Phase
;
public
float
X
;
public
float
Y
;
public
float
Pressure
;
public
int
Id
;
#pragma warning restore 649
}
private
struct
NativeApi
{
[
DllImport
(
InstantPreviewManager
.
InstantPreviewNativeApi
)]
public
static
extern
void
GetTouches
(
out
IntPtr
touches
,
out
int
count
);
[
DllImport
(
InstantPreviewManager
.
InstantPreviewNativeApi
)]
public
static
extern
void
UnityGotTouches
();
}
}
}
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewInput.cs.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: ed2d2995c742a6c4490fa51080dbf4cf
timeCreated: 1512422473
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs
0 → 100644
View file @
6a0cd565
This diff is collapsed.
Click to expand it.
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewManager.cs.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: 8d78f35e6ec68ed4ba199eddf266e308
timeCreated: 1513720134
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs
0 → 100644
View file @
6a0cd565
//-----------------------------------------------------------------------
// <copyright file="InstantPreviewTrackedPoseDriver.cs" company="Google">
//
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
//-----------------------------------------------------------------------
namespace
GoogleARCore
{
using
UnityEngine
;
/// <summary>
/// Drives cameras when using Instant Preview, since there is no easy way to
/// provide data to Unity's TrackedPoseDriver.
/// </summary>
public
class
InstantPreviewTrackedPoseDriver
:
MonoBehaviour
{
/// <summary>
/// Updates the game object's local transform to that of the latest pose
/// received by Instant Preview.
/// </summary>
public
void
Update
()
{
if
(!
Application
.
isEditor
)
{
return
;
}
transform
.
localPosition
=
Frame
.
Pose
.
position
;
transform
.
localRotation
=
Frame
.
Pose
.
rotation
;
}
}
}
IT17160926/Assets/GoogleARCore/SDK/InstantPreview/Scripts/InstantPreviewTrackedPoseDriver.cs.meta
0 → 100644
View file @
6a0cd565
fileFormatVersion: 2
guid: 307167e96a9af144789862588807c91b
timeCreated: 1512450063
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment