Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
World Analysis ARFoundation Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ARF
World Analysis API helpers
World Analysis ARFoundation Wrapper
Commits
608fce80
Commit
608fce80
authored
9 months ago
by
lacoche
Browse files
Options
Downloads
Patches
Plain Diff
remove some log, wait for arsession to be ready for loading arkit world map
parent
900e2250
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
WA now supports multiple trackable modules, add module mesh for iOS,...
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs
+1
-7
1 addition, 7 deletions
Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs
Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs
+36
-19
36 additions, 19 deletions
...e/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs
with
37 additions
and
26 deletions
Runtime/Scripts/WorldAnalysisARFoundationCoroutineHelper.cs
+
1
−
7
View file @
608fce80
...
...
@@ -8,11 +8,6 @@ public class WorldAnalysisARFoundationCoroutineHelper : MonoBehaviour
private
void
Awake
()
{
// If there is an instance, and it's not me, delete myself.
Debug
.
Log
(
"HERE SINGLETON AWAKE"
);
if
(
Instance
!=
null
&&
Instance
!=
this
)
{
Destroy
(
this
);
...
...
@@ -25,7 +20,6 @@ public class WorldAnalysisARFoundationCoroutineHelper : MonoBehaviour
public
void
StartACoroutine
(
IEnumerator
coroutine
)
{
Debug
.
Log
(
"HERE SINGLETON"
);
StartCoroutine
(
coroutine
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Runtime/Scripts/WorldAnalysisARFoundationModuleARKitWorldMap.cs
+
36
−
19
View file @
608fce80
...
...
@@ -119,6 +119,8 @@ public class WorldAnalysisARFoundationModuleARKitWorldMap : WorldAnalysisARFound
{
foreach
(
var
trackedAnchor
in
eventArgs
.
updated
)
{
Debug
.
Log
(
"Anchor found "
+
trackedAnchor
.
trackableId
.
ToString
());
if
(
trackedAnchor
.
trackableId
.
ToString
()
==
m_arfoundationAnchorTrackableId
)
{
/// look for an anchor with the trackable Id correspond to the ETSI ARF trackable name
...
...
@@ -137,12 +139,14 @@ public class WorldAnalysisARFoundationModuleARKitWorldMap : WorldAnalysisARFound
{
if
(
url
.
Length
>
0
)
{
Debug
.
Log
(
"Load AR Map from URL"
);
LoadWorldMapFromURL
(
url
);
// don't check if url is valid
return
true
;
}
else
{
Debug
.
Log
(
"Load AR Map locally"
);
string
localMap
=
Application
.
persistentDataPath
+
"/ARkitWorlMap.map"
;
if
(
File
.
Exists
(
localMap
))
{
...
...
@@ -191,31 +195,44 @@ public class WorldAnalysisARFoundationModuleARKitWorldMap : WorldAnalysisARFound
/// <returns>coroutine</returns>
public
IEnumerator
CoroutineLoadWorldMap
(
string
mapPath
)
{
while
(
ARSession
.
state
==
ARSessionState
.
CheckingAvailability
||
ARSession
.
state
==
ARSessionState
.
None
||
ARSession
.
state
==
ARSessionState
.
SessionInitializing
)
{
// wait for ar session to be ready
yield
return
null
;
}
ARSession
session
=
Component
.
FindAnyObjectByType
<
ARSession
>()
;
ARKitSessionSubsystem
sessionSubsystem
=
(
ARKitSessionSubsystem
)
session
.
subsystem
;
FileStream
file
;
file
=
File
.
Open
(
mapPath
,
FileMode
.
Open
);
const
int
bytesPerFrame
=
1024
*
10
;
var
bytesRemaining
=
file
.
Length
;
var
binaryReader
=
new
BinaryReader
(
file
);
var
allBytes
=
new
List
<
byte
>();
while
(
bytesRemaining
>
0
)
if
(
sessionSubsystem
==
null
)
{
var
bytes
=
binaryReader
.
ReadBytes
(
bytesPerFrame
);
allBytes
.
AddRange
(
bytes
);
bytesRemaining
-=
bytesPerFrame
;
yield
return
null
;
Debug
.
Log
(
"Cannot load map: no ARKitSessionSubsystem"
);
}
var
data
=
new
NativeArray
<
byte
>(
allBytes
.
Count
,
Allocator
.
Temp
);
data
.
CopyFrom
(
allBytes
.
ToArray
());
ARWorldMap
worldMap
;
if
(
ARWorldMap
.
TryDeserialize
(
data
,
out
worldMap
))
else
{
data
.
Dispose
();
FileStream
file
;
file
=
File
.
Open
(
mapPath
,
FileMode
.
Open
);
const
int
bytesPerFrame
=
1024
*
10
;
var
bytesRemaining
=
file
.
Length
;
var
binaryReader
=
new
BinaryReader
(
file
);
var
allBytes
=
new
List
<
byte
>();
while
(
bytesRemaining
>
0
)
{
var
bytes
=
binaryReader
.
ReadBytes
(
bytesPerFrame
);
allBytes
.
AddRange
(
bytes
);
bytesRemaining
-=
bytesPerFrame
;
yield
return
null
;
}
var
data
=
new
NativeArray
<
byte
>(
allBytes
.
Count
,
Allocator
.
Temp
);
data
.
CopyFrom
(
allBytes
.
ToArray
());
ARWorldMap
worldMap
;
if
(
ARWorldMap
.
TryDeserialize
(
data
,
out
worldMap
))
{
data
.
Dispose
();
}
sessionSubsystem
.
ApplyWorldMap
(
worldMap
);
UpdateTrackableInfoWithPose
(
Vector3
.
zero
,
Quaternion
.
identity
);
// before trying to find an anchor: default pause is origin of the map
}
sessionSubsystem
.
ApplyWorldMap
(
worldMap
);
UpdateTrackableInfoWithPose
(
Vector3
.
zero
,
Quaternion
.
identity
);
// before trying to find an anchor: default pause is origin of the map
}
}
#
endif
\ No newline at end of file
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