Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
ARCore Unreal sample developer preview 2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
bopangzz committed Dec 14, 2017
1 parent ef03686 commit 20c214d
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 29 deletions.
88 changes: 74 additions & 14 deletions HelloARSample/Config/DefaultEngine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,8 @@ AppliedTargetedHardwareClass=Mobile
DefaultGraphicsPerformance=Scalable
AppliedDefaultGraphicsPerformance=Scalable

[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
MinSDKVersion=24
bFullScreen=True
bBuildForArm64=False
bBuildForArmV7=True
Orientation=Portrait
TargetSDKVersion=24
PackageName=com.google.ar.core.examples.unreal.helloar
ApplicationDisplayName=Hello AR UE4
bPackageDataInsideApk=True
AndroidGraphicsDebugger=None
bUseExternalFilesDir=False

[/Script/GoogleARCoreBase.GoogleARCoreEditorSettings]
DefaultSessionConfig=(bAutoConnect=True,bAutoRequestRuntimePermissions=True,PlaneDetectionMode=HorizontalPlane,bSyncGameFrameRateWithPassthroughCamera=False,bLinkCameraToGoogleARDevice=True,bEnablePassthroughCameraRendering=True)
DefaultSessionConfig=(LightEstimationMode=AmbientIntensity,PlaneDetectionMode=HorizontalPlane,FrameUpdateMode=SyncTickWithoutCameraImage,bEnablePassthroughCameraRendering=True)

[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/HelloAR.HelloAR
Expand All @@ -109,6 +96,78 @@ ServerDefaultMap=/Engine/Maps/Entry.Entry
GlobalDefaultGameMode=/Game/Blueprints/HelloARGameMode.HelloARGameMode_C
GlobalDefaultServerGameMode=None

[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
PackageName=com.google.ar.core.examples.unreal.helloar
StoreVersion=1
ApplicationDisplayName=Hello AR UE4
VersionDisplayName=1.0
MinSDKVersion=24
TargetSDKVersion=24
InstallLocation=InternalOnly
bEnableGradle=True
bPackageDataInsideApk=True
bCreateAllPlatformsInstall=False
bDisableVerifyOBBOnStartUp=False
bUseExternalFilesDir=False
Orientation=Portrait
MaxAspectRatio=2.100000
AntVerbosity=Quiet
bFullScreen=True
bEnableNewKeyboard=False
DepthBufferPreference=Default
ExtraApplicationSettings=
ExtraActivitySettings=
bAndroidVoiceEnabled=False
bPackageForGearVR=False
bRemoveOSIG=False
+GoogleVRCaps=Cardboard
+GoogleVRCaps=Daydream63
bGoogleVRSustainedPerformance=False
KeyStore=
KeyAlias=
KeyStorePassword=
KeyPassword=
bBuildForArmV7=False
bBuildForArm64=True
bBuildForX86=False
bBuildForX8664=False
bBuildForES2=True
bBuildForES31=False
bSupportsVulkan=False
bBuildWithHiddenSymbolVisibility=False
bEnableGooglePlaySupport=False
bUseGetAccounts=False
GamesAppID=
bSupportAdMob=True
AdMobAdUnitID=
GooglePlayLicenseKey=
GCMClientSenderID=
bShowLaunchImage=False
AndroidAudio=Default
AudioSampleRate=44100
AudioCallbackBufferFrameSize=1024
AudioNumBuffersToEnqueue=4
AudioMaxChannels=0
AudioNumSourceWorkers=0
SpatializationPlugin=
ReverbPlugin=
OcclusionPlugin=
AndroidGraphicsDebugger=None
MaliGraphicsDebuggerPath=(Path="")
RenderDocPath=(Path="")
bMultiTargetFormat_ETC1=True
bMultiTargetFormat_ETC2=True
bMultiTargetFormat_DXT=True
bMultiTargetFormat_PVRTC=True
bMultiTargetFormat_ATC=True
bMultiTargetFormat_ASTC=True
TextureFormatPriority_ETC1=0.100000
TextureFormatPriority_ETC2=0.200000
TextureFormatPriority_DXT=0.600000
TextureFormatPriority_PVRTC=0.800000
TextureFormatPriority_ATC=0.500000
TextureFormatPriority_ASTC=0.900000

[/Script/Engine.PhysicsSettings]
DefaultGravityZ=-980.000000
DefaultTerminalVelocity=4000.000000
Expand Down Expand Up @@ -149,3 +208,4 @@ SyncSceneSmoothingFactor=0.000000
AsyncSceneSmoothingFactor=0.990000
InitialAverageFrameRate=0.016667
PhysXTreeRebuildRate=10

1 change: 1 addition & 0 deletions HelloARSample/Config/DefaultGame.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
ProjectID=37E772544EA40387985AAC889F6C1FE1
ProjectName=HelloAR
CopyrightNotice="// Copyright 2017 Google Inc.//// 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."
bStartInAR=True

Binary file modified HelloARSample/Content/Blueprints/ARCorePlaneActor.uasset
Binary file not shown.
Binary file modified HelloARSample/Content/Blueprints/AndyAnchorActor.uasset
Binary file not shown.
Binary file modified HelloARSample/Content/Blueprints/HelloARHudWidget.uasset
Binary file not shown.
Binary file modified HelloARSample/Content/Blueprints/HelloARManager.uasset
Binary file not shown.
Binary file modified HelloARSample/Content/Blueprints/HelloARPawn.uasset
Binary file not shown.
Binary file not shown.
Binary file modified HelloARSample/Content/Maps/HelloAR.umap
Binary file not shown.
Binary file modified HelloARSample/Content/Maps/HelloAR_BuiltData.uasset
Binary file not shown.
15 changes: 15 additions & 0 deletions HelloARSample/HelloARUnreal.uproject
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@
{
"Name": "SteamVR",
"Enabled": false
},
{
"Name": "OnlineSubsystemGooglePlay",
"Enabled": false,
"SupportedTargetPlatforms": [
"Android"
]
},
{
"Name": "OnlineSubsystemIOS",
"Enabled": false,
"SupportedTargetPlatforms": [
"IOS",
"TVOS"
]
}
]
}
1 change: 0 additions & 1 deletion HelloARSample/Source/HelloARUnreal/HelloARUnreal.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public HelloARUnreal(ReadOnlyTargetRules Target) : base(Target)
PrivateDependencyModuleNames.AddRange(new string[] {
"GoogleARCoreBase",
"ProceduralMeshComponent",
"TangoSDK"
});

// Uncomment if you are using Slate UI
Expand Down
20 changes: 7 additions & 13 deletions HelloARSample/Source/HelloARUnreal/Private/ARPlaneActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "ProceduralMeshComponent.h"
#include "Components/InstancedStaticMeshComponent.h"

#include "GoogleARCorePlane.h"
#include "GoogleARCoreTypes.h"

// Sets default values
AARPlaneActor::AARPlaneActor()
Expand All @@ -32,18 +32,15 @@ AARPlaneActor::AARPlaneActor()
// Called every frame
void AARPlaneActor::Tick(float DeltaTime)
{
// No need to tick when the plane isn't assigned or hasn't been updated.
if (IsValid(ARCorePlaneObject) && ARCorePlaneObject->IsUpdated())
{
UpdatePlanePolygonMesh();
}
Super::Tick(DeltaTime);
PlanePolygonMeshComponent->SetWorldTransform(ARCorePlaneObject->GetCenterPose());
}

void AARPlaneActor::UpdatePlanePolygonMesh()
{
// Update polygon mesh vertex indices, using triangle fan due to its convex.
const TArray<FVector>& BoundaryVertices = ARCorePlaneObject->GetWorldSpaceBoundaryPolygon();
TArray<FVector> BoundaryVertices;
ARCorePlaneObject->GetBoundaryPolygonInLocalSpace(BoundaryVertices);
int BoundaryVerticesNum = BoundaryVertices.Num();

if (BoundaryVerticesNum < 3)
Expand All @@ -66,16 +63,13 @@ void AARPlaneActor::UpdatePlanePolygonMesh()
PolygonMeshIndices.Empty(TriangleNum * 3);
PolygonMeshNormals.Empty(PolygonMeshVerticesNum);

// Generate vertex data
// Revisit here to see if we want to calculate in local space
FVector BoundaryCenter = ARCorePlaneObject->GetBoundingBoxWorldTransform().GetLocation();
FVector PlaneNormal = ARCorePlaneObject->GetPlane().GetSafeNormal();
FVector PlaneNormal = ARCorePlaneObject->GetFPlane().GetSafeNormal();
for (int i = 0; i < BoundaryVerticesNum; i++)
{
FVector BoundaryPoint = BoundaryVertices[i];
float BoundaryToCenterDist = FVector::Dist(BoundaryPoint, BoundaryCenter);
float BoundaryToCenterDist = BoundaryPoint.Size();
float FeatheringDist = FMath::Min(BoundaryToCenterDist, EdgeFeatheringDistance);
FVector InteriorPoint = BoundaryPoint + (BoundaryCenter - BoundaryPoint).GetUnsafeNormal() * FeatheringDist;
FVector InteriorPoint = BoundaryPoint - BoundaryPoint.GetUnsafeNormal() * FeatheringDist;

PolygonMeshVertices.Add(BoundaryPoint);
PolygonMeshVertices.Add(InteriorPoint);
Expand Down
3 changes: 2 additions & 1 deletion HelloARSample/Source/HelloARUnreal/Public/ARPlaneActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ class HELLOARUNREAL_API AARPlaneActor : public AActor
UPROPERTY(Category = GoogleARCorePlaneActor, EditAnywhere, BlueprintReadWrite)
float EdgeFeatheringDistance = 10.0f;


public:
// Called every frame
virtual void Tick(float DeltaTime) override;

private:
UFUNCTION(BlueprintCallable, Category = "GoogleARCore|PlaneActor", meta = (Keywords = "googlear arcore plane"))
void UpdatePlanePolygonMesh();

};

0 comments on commit 20c214d

Please sign in to comment.