Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
WIP OSVR Implementation. RenderManager is disabled for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick committed Mar 10, 2017
1 parent ec8de19 commit adcfbfb
Show file tree
Hide file tree
Showing 25 changed files with 1,484 additions and 93 deletions.
1 change: 1 addition & 0 deletions C3DE.Demo/C3DE.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<Compile Include="Scenes\MenuDemo.cs" />
<Compile Include="Scenes\PreLightingDemo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scenes\VirtualRealityDemo.cs" />
<Compile Include="Scripts\AutoRotation.cs" />
<Compile Include="Scripts\ControllerSwitcher.cs" />
<Compile Include="Scripts\DemoBehaviour.cs" />
Expand Down
6 changes: 4 additions & 2 deletions C3DE.Demo/Scenes/VirtualRealityDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public override void Initialize()

_prevRenderer = Application.Engine.Renderer;

var vrDevice = new OpenVRService(Application.Engine);
Application.Engine.Renderer = new VRRenderer(Application.GraphicsDevice, vrDevice);
var vrDevice = new OSVRService(Application.Engine);
var vrRenderer = new VRRenderer(Application.GraphicsDevice, vrDevice);
vrRenderer.StereoPreview = true;
Application.Engine.Renderer = vrRenderer;
}

public override void Unload()
Expand Down
31 changes: 25 additions & 6 deletions C3DE/C3DE.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OculusWrap">
<HintPath>..\Deps\OculusWrap.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -155,12 +158,28 @@
<Compile Include="Rendering\PreLightRenderer.cs" />
<Compile Include="VR\IVRDevice.cs" />
<Compile Include="VR\NullVRService.cs" />
<Compile Include="VR\OculusRift.cs" />
<Compile Include="VR\OculusRiftService.cs" />
<Compile Include="VR\OculusWrapService.cs" />
<Compile Include="VR\OpenVRService.cs" />
<Compile Include="VR\openvr_api.cs" />
<Compile Include="VR\OSVRService.cs" />
<Compile Include="VR\Oculus\OculusRift.cs" />
<Compile Include="VR\Oculus\OculusRiftService.cs" />
<Compile Include="VR\Oculus\OculusWrapService.cs" />
<Compile Include="VR\OpenVR\OpenVRService.cs" />
<Compile Include="VR\OpenVR\openvr_api.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\DeviceDescriptor.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\Math.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\Sample\Axes.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\Sample\MouselookPoseSignal.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\Sample\SampleGame.cs" />
<Compile Include="VR\OSVR\OSVRService.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\ReportTypes.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\VREye.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\VRHead.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\XnaEyeTracker3DInterface.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\XnaOrientationInterface.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\XnaPoseInterface.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\XnaPosition2DInterface.cs" />
<Compile Include="VR\OSVR\OSVR.MonoGame\XnaPositionInterface.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
4 changes: 2 additions & 2 deletions C3DE/Rendering/VRRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ private void DrawEyeViewIntoBackbuffer(int eye)
if (StereoPreview)
{
width = pp.BackBufferWidth / 2;
m_spriteBatch.Draw(renderTargetEye[0], new Rectangle(0, 0, width, height), null, Color.White, MathHelper.Pi, Vector2.Zero, _vrDevice.PreviewRenderEffect, 0);
m_spriteBatch.Draw(renderTargetEye[1], new Rectangle(width, 0, width, height), null, Color.White, MathHelper.Pi, Vector2.Zero, _vrDevice.PreviewRenderEffect, 0);
m_spriteBatch.Draw(renderTargetEye[0], new Rectangle(0, 0, width, height), null, Color.White, 0, Vector2.Zero, _vrDevice.PreviewRenderEffect, 0);
m_spriteBatch.Draw(renderTargetEye[1], new Rectangle(width, 0, width, height), null, Color.White, 0, Vector2.Zero, _vrDevice.PreviewRenderEffect, 0);
}
else
m_spriteBatch.Draw(renderTargetEye[eye], new Rectangle(offset, 0, width, height), null, Color.White, 0, Vector2.Zero, _vrDevice.PreviewRenderEffect, 0);
Expand Down
Loading

0 comments on commit adcfbfb

Please sign in to comment.