Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LSL4Unity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
The Openvibe Group
Unity Apps
LSL4Unity
Commits
a2b966fc
Commit
a2b966fc
authored
8 years ago
by
Markus Fleck
Browse files
Options
Downloads
Patches
Plain Diff
Add missing method requested in issue #13
parent
b43e70bf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Demos/Demo_IncomingStreams.unity
+9
-148
9 additions, 148 deletions
Demos/Demo_IncomingStreams.unity
Scripts/BaseInlet.cs
+28
-2
28 additions, 2 deletions
Scripts/BaseInlet.cs
Scripts/Examples/DemoInletForFloatSamples.cs
+21
-0
21 additions, 0 deletions
Scripts/Examples/DemoInletForFloatSamples.cs
with
58 additions
and
150 deletions
Demos/Demo_IncomingStreams.unity
+
9
−
148
View file @
a2b966fc
...
...
@@ -134,8 +134,13 @@ MonoBehaviour:
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
-
m_Target
:
{
fileID
:
2059534480
}
m_MethodName
:
AStreamIsFound
m_TypeName
:
Assets.LSL4Unity.Scripts.StreamEvent, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
onStreamLost
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
193850119
}
m_MethodName
:
AStreamGotLost
m_Mode
:
0
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
...
...
@@ -147,11 +152,6 @@ MonoBehaviour:
m_CallState
:
2
m_TypeName
:
Assets.LSL4Unity.Scripts.StreamEvent, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
onStreamLost
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
Assets.LSL4Unity.Scripts.StreamEvent, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
---
!u!4
&68353127
Transform
:
m_ObjectHideFlags
:
0
...
...
@@ -178,7 +178,7 @@ GameObject:
-
component
:
{
fileID
:
193850116
}
-
component
:
{
fileID
:
193850119
}
m_Layer
:
0
m_Name
:
A
m_Name
:
A
ObjectListeningToAStream
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
...
...
@@ -191,7 +191,7 @@ Transform:
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
193850114
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
-1
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
753183517
}
...
...
@@ -360,8 +360,6 @@ GameObject:
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
753183517
}
-
component
:
{
fileID
:
753183518
}
-
component
:
{
fileID
:
753183516
}
m_Layer
:
0
m_Name
:
IncomingStreams
m_TagString
:
Untagged
...
...
@@ -369,24 +367,6 @@ GameObject:
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&753183516
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
753183515
}
m_Enabled
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
87163fb44bc059c4d99f26b875930ecf
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
moment
:
0
StreamName
:
RandomSpehricalData_B
StreamType
:
3DCoord
targetTransform
:
{
fileID
:
2059534476
}
useX
:
0
useY
:
0
useZ
:
0
---
!u!4
&753183517
Transform
:
m_ObjectHideFlags
:
0
...
...
@@ -398,28 +378,9 @@ Transform:
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
-
{
fileID
:
193850115
}
-
{
fileID
:
2059534476
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
2
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&753183518
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
753183515
}
m_Enabled
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
87163fb44bc059c4d99f26b875930ecf
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
moment
:
0
StreamName
:
RandomSpehricalData_A
StreamType
:
3DCoord
targetTransform
:
{
fileID
:
193850115
}
useX
:
0
useY
:
0
useZ
:
0
---
!u!1
&1295183507
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -483,103 +444,3 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
50
,
y
:
-30
,
z
:
0
}
---
!u!1
&2059534475
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
2059534476
}
-
component
:
{
fileID
:
2059534479
}
-
component
:
{
fileID
:
2059534478
}
-
component
:
{
fileID
:
2059534477
}
-
component
:
{
fileID
:
2059534480
}
m_Layer
:
0
m_Name
:
B
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&2059534476
Transform
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2059534475
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
1
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
753183517
}
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!23
&2059534477
MeshRenderer
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2059534475
}
m_Enabled
:
1
m_CastShadows
:
1
m_ReceiveShadows
:
1
m_MotionVectors
:
1
m_LightProbeUsage
:
1
m_ReflectionProbeUsage
:
1
m_Materials
:
-
{
fileID
:
10303
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
m_StaticBatchRoot
:
{
fileID
:
0
}
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_PreserveUVs
:
1
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
m_SelectedEditorRenderState
:
3
m_MinimumChartSize
:
4
m_AutoUVMaxDistance
:
0.5
m_AutoUVMaxAngle
:
89
m_LightmapParameters
:
{
fileID
:
0
}
m_SortingLayerID
:
0
m_SortingOrder
:
0
---
!u!136
&2059534478
CapsuleCollider
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2059534475
}
m_Material
:
{
fileID
:
0
}
m_IsTrigger
:
0
m_Enabled
:
1
m_Radius
:
0.5
m_Height
:
2
m_Direction
:
1
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!33
&2059534479
MeshFilter
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2059534475
}
m_Mesh
:
{
fileID
:
10206
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
---
!u!114
&2059534480
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2059534475
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
5ba4ed7276e95054fb35c620c2207e28
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
StreamName
:
RandomSpehricalData_B
StreamType
:
3DCoord
targetTransform
:
{
fileID
:
2059534476
}
useX
:
0
useY
:
1
useZ
:
0
This diff is collapsed.
Click to expand it.
Scripts/BaseInlet.cs
+
28
−
2
View file @
a2b966fc
using
LSL
;
using
System
;
using
System.Linq
;
using
UnityEngine
;
using
UnityEngine.Events
;
namespace
Assets.LSL4Unity.Scripts.AbstractInlets
{
...
...
@@ -14,6 +16,26 @@ namespace Assets.LSL4Unity.Scripts.AbstractInlets
protected
int
expectedChannels
;
protected
Resolver
resolver
;
/// <summary>
/// Call this method when your inlet implementation got created at runtime
/// </summary>
protected
virtual
void
registerAndLookUpStream
()
{
resolver
=
FindObjectOfType
<
Resolver
>();
resolver
.
onStreamFound
.
AddListener
(
new
UnityAction
<
LSLStreamInfoWrapper
>(
AStreamIsFound
));
resolver
.
onStreamLost
.
AddListener
(
new
UnityAction
<
LSLStreamInfoWrapper
>(
AStreamGotLost
));
if
(
resolver
.
knownStreams
.
Any
(
isTheExpected
))
{
var
stream
=
resolver
.
knownStreams
.
First
(
isTheExpected
);
AStreamIsFound
(
stream
);
}
}
/// <summary>
/// Callback method for the Resolver gets called each time the resolver found a stream
/// </summary>
...
...
@@ -43,9 +65,12 @@ namespace Assets.LSL4Unity.Scripts.AbstractInlets
this
.
enabled
=
false
;
}
pr
ivate
bool
isTheExpected
(
LSLStreamInfoWrapper
stream
)
pr
otected
virtual
bool
isTheExpected
(
LSLStreamInfoWrapper
stream
)
{
return
StreamName
.
Equals
(
stream
.
Name
);
bool
predicate
=
StreamName
.
Equals
(
stream
.
Name
);
predicate
&=
StreamType
.
Equals
(
stream
.
Type
);
return
predicate
;
}
protected
abstract
void
pullSamples
();
...
...
@@ -55,6 +80,7 @@ namespace Assets.LSL4Unity.Scripts.AbstractInlets
// base implementation may not decide what happens when the stream gets available
throw
new
NotImplementedException
(
"Please override this method in a derived class!"
);
}
}
public
abstract
class
InletFloatSamples
:
ABaseInlet
...
...
This diff is collapsed.
Click to expand it.
Scripts/Examples/DemoInletForFloatSamples.cs
+
21
−
0
View file @
a2b966fc
...
...
@@ -21,8 +21,29 @@ namespace Assets.LSL4Unity.Scripts.Examples {
public
bool
useY
;
public
bool
useZ
;
void
Start
()
{
// [optional] call this only, if your gameobject hosting this component
// got instantiated during runtime
// registerAndLookUpStream();
}
protected
override
bool
isTheExpected
(
LSLStreamInfoWrapper
stream
)
{
// the base implementation just checks for stream name and type
var
predicate
=
base
.
isTheExpected
(
stream
);
// add a more specific description for your stream here specifying hostname etc.
//predicate &= stream.HostName.Equals("Expected Hostname");
return
predicate
;
}
/// <summary>
/// Override this method to implement whatever should happen with the samples...
/// IMPORTANT: Avoid heavy processing logic within this method, update a state and use
/// coroutines for more complexe processing tasks to distribute processing time over
/// several frames
/// </summary>
/// <param name="newSample"></param>
/// <param name="timeStamp"></param>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment