mGlAbstraction,
mGlSyncAbstraction,
mGestureManager,
+ NULL,
mDataRetentionPolicy);
mCore->ContextCreated();
#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/events/event.h>
#include <dali/integration-api/gl-sync-abstraction.h>
+#include <dali/integration-api/gyroscope-sensor.h>
#include <dali/internal/common/core-impl.h>
namespace Dali
{
Core* Core::New(RenderController& renderController, PlatformAbstraction& platformAbstraction,
- GlAbstraction& glAbstraction, GlSyncAbstraction& glSyncAbstraction, GestureManager& gestureManager, ResourcePolicy::DataRetention policy )
+ GlAbstraction& glAbstraction, GlSyncAbstraction& glSyncAbstraction, GestureManager& gestureManager, GyroscopeSensor* gyroscopeSensor, ResourcePolicy::DataRetention policy )
{
Core* instance = new Core;
- instance->mImpl = new Internal::Core( renderController, platformAbstraction, glAbstraction, glSyncAbstraction, gestureManager, policy );
+ instance->mImpl = new Internal::Core( renderController, platformAbstraction, glAbstraction, glSyncAbstraction, gestureManager, gyroscopeSensor, policy );
return instance;
}
class PlatformAbstraction;
class RenderController;
class SystemOverlay;
+class GyroscopeSensor;
struct Event;
struct TouchData;
GlAbstraction& glAbstraction,
GlSyncAbstraction& glSyncAbstraction,
GestureManager& gestureManager,
+ GyroscopeSensor* gyroscopeSensor,
ResourcePolicy::DataRetention policy);
/**
$(platform_abstraction_src_dir)/resource-cache.h \
$(platform_abstraction_src_dir)/resource-declarations.h \
$(platform_abstraction_src_dir)/gl-abstraction.h \
+ $(platform_abstraction_src_dir)/gyroscope-sensor.h \
$(platform_abstraction_src_dir)/gl-defines.h \
$(platform_abstraction_src_dir)/gl-sync-abstraction.h \
$(platform_abstraction_src_dir)/gesture-manager.h \
--- /dev/null
+#ifndef __DALI_GYROSCOPE_SENSOR_H__
+#define __DALI_GYROSCOPE_SENSOR_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+
+namespace Dali
+{
+class Vector4;
+
+namespace Integration
+{
+
+// EXTERNAL INCLUDES
+class GyroscopeSensor
+{
+public:
+
+ GyroscopeSensor() {}
+ virtual ~GyroscopeSensor() {}
+
+ virtual void Enable() = 0;
+ virtual void Disable() = 0;
+ virtual void Read( Dali::Vector4& data ) = 0;
+ virtual void ReadPackets( Dali::Vector4* data, int count ) = 0;
+ virtual bool IsEnabled() = 0;
+ virtual bool IsSupported() = 0;
+};
+
+} // Integration
+} // Dali
+
+#endif
using Integration::Event;
using Integration::UpdateStatus;
using Integration::RenderStatus;
+using Integration::GyroscopeSensor;
Core::Core( RenderController& renderController, PlatformAbstraction& platform,
GlAbstraction& glAbstraction, GlSyncAbstraction& glSyncAbstraction,
- GestureManager& gestureManager, ResourcePolicy::DataRetention dataRetentionPolicy)
+ GestureManager& gestureManager, GyroscopeSensor* gyroscopeSensor, ResourcePolicy::DataRetention dataRetentionPolicy)
: mRenderController( renderController ),
mPlatform(platform),
mGestureEventProcessor(NULL),
mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController( mRenderController ) );
mStage->Initialize();
-
+ mStage->SetGyroscopeSensor( gyroscopeSensor );
mResourceClient = new ResourceClient( *mResourceManager, *mStage );
mGestureEventProcessor = new GestureEventProcessor(*mStage, gestureManager, mRenderController);
mImageFactory = new ImageFactory( *mResourceClient );
mShaderFactory = new ShaderFactory();
mUpdateManager->SetShaderSaver( *mShaderFactory );
+ mUpdateManager->SetGyroscopeSensor( *gyroscopeSensor );
mShaderFactory->LoadDefaultShaders();
GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions();
class SystemOverlay;
class UpdateStatus;
class RenderStatus;
+class GyroscopeSensor;
struct Event;
struct TouchData;
}
Integration::GlAbstraction& glAbstraction,
Integration::GlSyncAbstraction& glSyncAbstraction,
Integration::GestureManager& gestureManager,
+ Integration::GyroscopeSensor* gyroscopeSensor,
ResourcePolicy::DataRetention dataRetentionPolicy );
/**
return mInvertYAxis;
}
+
+void CameraActor::SetFrustum( float left, float right, float bottom, float top, float near, float far, float eyePosBias )
+{
+ Matrix result;
+ float a = (right + left)/(right-left);
+ float b = (top+bottom)/(top-bottom);
+ float c = -(far+near)/(far-near);
+ float d = -(2*far*near)/(far-near);
+ float e = - (2*near)/(right-left);
+ float f = (2*near)/(top-bottom);
+
+ float mat[16] =
+ {
+ e, 0, a, 0,
+ 0, f, b, 0,
+ 0, 0, c, d,
+ 0, 0,-1, 0
+ };
+
+ std::copy( mat, mat+16, result.AsFloat() );
+}
+
+void CameraActor::SetPerspectiveProjectionFovY( float fovY, float aspect, float near, float far, const Vector2& stereoBias )
+{
+ SetAspectRatio( aspect );
+ SetNearClippingPlane( near );
+ SetFarClippingPlane( far );
+ SetFieldOfView( fovY );
+ SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
+ SetStereoBiasMessage( GetEventThreadServices(), *mSceneObject, stereoBias );
+}
+
void CameraActor::SetPerspectiveProjection( const Size& size, const Vector2& stereoBias /* = Vector2::ZERO */ )
{
float width = size.width;
void SetPerspectiveProjection( const Size& size, const Vector2& stereoBias = Vector2::ZERO );
/**
+ * @brief SetPerspectiveProjectionFovY
+ * @param fovY
+ * @param size
+ * @param stereoBias
+ */
+ void SetPerspectiveProjectionFovY( float fovY, float aspect, float near, float far, const Vector2& stereoBias );
+ /**
+ * @brief SetFrustum
+ * @param left
+ * @param right
+ * @param bottom
+ * @param top
+ * @param near
+ * @param far
+ */
+ void SetFrustum( float left, float right, float bottom, float top, float near, float far, float eyePosOffset = 0.0f );
+
+
+ /**
* @copydoc Dali::CameraActor::SetOrthographicProjection(const Vector2& size);
*/
void SetOrthographicProjection( const Vector2& size );
RIGHT
};
+//TODOVR: Gyroscope constraints
+struct GyroEyeConstraint
+{
+ GyroEyeConstraint( Dali::Internal::Stage* stage )
+ : stage( stage )
+ {
+ pitch = Radian(Degree(0.0f));
+ yaw = Radian(Degree(180.0f));
+ roll = Radian(Degree(0.0f));
+ }
+
+ void operator()( Quaternion& current, const PropertyInputContainer& inputs )
+ {
+ // TODO: get gyro data, update rotation
+ // get data from gyroscope
+ Dali::Integration::GyroscopeSensor* sensor( stage->GetGyroscopeSensor() );
+ if( !sensor->IsEnabled() )
+ {
+ sensor->Enable();
+ current.SetEuler( Radian((pitch)), Radian((yaw)), Radian((roll)) );
+ }
+ else
+ {
+ const int packets = 16;
+ Dali::Vector4 accumulated;
+ sensor->ReadPackets( &accumulated, packets );
+ pitch = -accumulated.y;
+ yaw = accumulated.x;
+ roll = accumulated.z;
+ Quaternion rot;
+ rot.SetEuler( Radian((Degree(pitch))), Radian(Degree(yaw)), Radian(Degree(roll)) );
+ current *= rot;
+ }
+ //current = Dali::Quaternion()
+
+ }
+ Dali::Internal::Stage* stage;
+
+ float pitch;
+ float yaw;
+ float roll;
+};
+
//TODOVR
const float DEFAULT_STEREO_BASE( 10.0f );
//const float DEFAULT_STEREO_BASE( 15.0f );
case VR:
{
const float pixelAspect = GetDpi().y / GetDpi().x;
+ float stereoBase( 0.05f );
if( mSize.width > mSize.height )
{
}
else
{
+
+#if 0
// Portrait aspect - default to VR on device.
// Precalculations:
const float sizeY = mSize.x * pixelAspect;
const float viewPortHeight = mSize.y / 2.0f;
const float cameraAspect = pixelAspect * ( sizeY / viewPortHeight );
-
+ const float near = 100.0f;
+ const float far = 5000.0f;
// TODOVR: Base this off actual FoV values (EG. 96 degrees for GearVR)
// Recalculate fov based on viewport size.
- const float fov = std::atan( viewPortHeight / ( 2.0f * mSize.width ) );
+ const float fov = Radian( Degree(60) );//std::atan( viewPortHeight / ( 2.0f * mSize.width ) );
- mStereoInfo[LEFT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2::ZERO );
- //mStereoInfo[LEFT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2( 0.0f, stereoBase ) );
+ mStereoInfo[LEFT].camera->SetPerspectiveProjectionFovY( fov, cameraAspect, near, far, Vector2::ZERO );
mStereoInfo[LEFT].camera->SetAspectRatio( cameraAspect );
mStereoInfo[LEFT].camera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
mStereoInfo[LEFT].camera->SetFieldOfView( fov );
mStereoInfo[LEFT].renderTask.SetViewport( Viewport( 0, viewPortHeight, mSize.width, viewPortHeight ) );
- mStereoInfo[RIGHT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2::ZERO );
- //mStereoInfo[RIGHT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2( 0.0, -stereoBase ) );
+ mStereoInfo[RIGHT].camera->SetPerspectiveProjectionFovY( fov, cameraAspect, near, far, Vector2::ZERO );
mStereoInfo[RIGHT].camera->SetAspectRatio( cameraAspect );
mStereoInfo[RIGHT].camera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
mStereoInfo[RIGHT].camera->SetFieldOfView( fov );
mStereoInfo[RIGHT].renderTask.SetViewport( Viewport( 0, 0, mSize.width, viewPortHeight ) );
+
+ mDefaultCamera->SetPosition( 0.0f, 100.0f );
+#endif
+
+ // Portrait aspect - default to VR on device.
+ // Precalculations:
+ const float sizeY = mSize.x * pixelAspect;
+ const float viewPortHeight = mSize.y / 2.0f;
+ const float cameraAspect = pixelAspect * ( sizeY / viewPortHeight );
+
+ // TODOVR: Base this off actual FoV values (EG. 96 degrees for GearVR)
+ // Recalculate fov based on viewport size.
+ float fov = std::atan( viewPortHeight / ( 2.0f * mSize.width ) );
+ const float far = 300.0f;
+ float IPD = 0.0635f;
+ stereoBase = -IPD*0.5f;
+ const float near = IPD+0.1f;
+ //stereoBase = 0.0f;
+ fov = Radian( Degree(106) );
+ mStereoInfo[LEFT].camera->SetPerspectiveProjectionFovY( fov, cameraAspect, near, far, Vector2( 0.0f, +stereoBase ) );
+ //mStereoInfo[LEFT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2::ZERO );
+ //mStereoInfo[LEFT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2( 0.0f, stereoBase ) );
+ //mStereoInfo[LEFT].camera->SetAspectRatio( cameraAspect );
+ //mStereoInfo[LEFT].camera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
+ //mStereoInfo[LEFT].camera->SetFieldOfView( fov );
+ mStereoInfo[LEFT].renderTask.SetViewport( Viewport( 0, viewPortHeight, mSize.width, viewPortHeight ) );
+
+ //mStereoInfo[RIGHT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2::ZERO );
+ //mStereoInfo[RIGHT].camera->SetPerspectiveProjection( Size( mSize.width, sizeY ), Vector2( 0.0, -stereoBase ) );
+ mStereoInfo[RIGHT].camera->SetPerspectiveProjectionFovY( fov, cameraAspect, near, far, Vector2( 0.0f, -stereoBase ) );
+ //mStereoInfo[RIGHT].camera->SetAspectRatio( cameraAspect );
+ //mStereoInfo[RIGHT].camera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
+ //mStereoInfo[RIGHT].camera->SetFieldOfView( fov );
+ mStereoInfo[RIGHT].renderTask.SetViewport( Viewport( 0, 0, mSize.width, viewPortHeight ) );
+
}
+ // VR camera will be feed from gyroscope input, for now using constraints
+ // Camera needs to check gyroscope state every update, simple constraint will
+ // solve the problem, however we need to keep that 'fake' update running, so that
+ // there's 'infinite' animation running. This way we are able to hit the constraint
+ // every frame and update orientation.
+ mVRGyroEyeConstraint = Constraint::New<Quaternion>( mDefaultCamera.Get(),
+ Dali::Actor::Property::ORIENTATION,
+ GyroEyeConstraint( this ));
+ mVRGyroEyeConstraint.Apply();
+ Dali::Actor actor( mDefaultCamera.Get() );
+ Quaternion quaternion( Radian(Degree(0)), Vector3( 0.0f, 0.0f, 0.0f ));
+ mVRDefaultCameraAnimation = Dali::Animation::New( 1.0f );
+ mVRDefaultCameraAnimation.AnimateBy( Property( actor, Dali::Actor::Property::ORIENTATION ), quaternion, AlphaFunction::LINEAR );
+ mVRDefaultCameraAnimation.SetLooping( true );
+ mVRDefaultCameraAnimation.Play();
+
+ mStereoInfo[LEFT].camera->SetType( Camera::FREE_LOOK );
+ mStereoInfo[RIGHT].camera->SetType( Camera::FREE_LOOK );
+ //mDefaultCamera->SetType( Camera::VIRTUAL_REALITY );
// Same settings regardless of orientation:
- const float stereoBase( ( ( mStereoBase / 25.4f ) * GetDpi().y ) * 0.5f );
- mStereoInfo[LEFT].camera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
- mStereoInfo[RIGHT].camera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
+ //stereoBase = 0;
+ mStereoInfo[LEFT].camera->SetPosition( Vector3( 0.0f, -stereoBase, 0.0f ) );
+ mStereoInfo[RIGHT].camera->SetPosition( Vector3( 0.f, +stereoBase, 0.0f ) );
break;
}
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/render-tasks/render-task.h>
+#include <dali/public-api/animation/animation.h>
+
+#include <dali/integration-api/gyroscope-sensor.h>
namespace Dali
{
namespace Integration
{
class SystemOverlay;
+class GyroscopeSensor;
}
namespace Internal
*/
virtual BufferIndex GetEventBufferIndex() const;
+public:
+
+ // VR
+ void SetGyroscopeSensor( Dali::Integration::GyroscopeSensor* sensor )
+ {
+ mGyroscopeSensor = sensor;
+ }
+
+ Dali::Integration::GyroscopeSensor* GetGyroscopeSensor()
+ {
+ return mGyroscopeSensor;
+ }
+
private:
/**
// The list of render-tasks
IntrusivePtr<RenderTaskList> mRenderTaskList;
+ Dali::Integration::GyroscopeSensor* mGyroscopeSensor;
//TODOVR
struct StereoInfo
Dali::Stage::ContextStatusSignal mContextRegainedSignal;
Dali::Stage::SceneCreatedSignalType mSceneCreatedSignal;
+
+ //VR
+ Constraint mVRGyroEyeConstraint;
+ Dali::Animation mVRDefaultCameraAnimation; /// To keep camera update running and keep hitting constraint
};
} // namespace Internal
m[15] = 1.0f;
}
+/*
void LookAt(Matrix& result, const Vector3& eye, const Vector3& target, const Vector3& up)
{
Vector3 vZ = target - eye;
result.SetInverseTransformComponents(vX, vY, vZ, eye);
}
-
+*/
}
void RenderManager::SetupVRMode()
mImpl->defaultSurfaceRect.width,
mImpl->defaultSurfaceRect.height,
0, GL_RGBA, GL_UNSIGNED_BYTE, 0 ) );
- GL( ctx.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ) );
- GL( ctx.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ) );
+ GL( ctx.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) );
+ GL( ctx.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) );
GL( ctx.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, vr.mainFrameBufferAttachments[0], 0 ) );
// depth/stencil attachment
" vec3 pos = aPosition;\n"
//" pos.y -= 1.0;\n"
" gl_Position = mvp * vec4( pos, 1.0 );\n"
- " vTexCoord = aTexCoord;\n"
+ " mediump vec2 uvs = vec2( aTexCoord );\n"
+// " uvs.r = 1.0 - uvs.r;\n"
+ " vTexCoord = uvs;\n"
"}\n\0",
// fragment shader
"void main()\n"
"{ \n"
#ifdef DEBUG_DISABLE_BARREL_DISTORTION
+#ifdef DEBUG_VR_TINT_EACH_EYE
" mediump vec4 mulcol = vec4( 1.0, 0.0, 0.0, 1.0 );\n"
" if( vTexCoord.y < 0.5 ) { mulcol = vec4( 0.0, 1.0, 0.0, 1.0 ); }\n"
" gl_FragColor = texture2D( texSampler, vTexCoord ) * mulcol;\n"
#else
" gl_FragColor = texture2D( texSampler, vTexCoord );\n"
#endif
+#else
+ " gl_FragColor = texture2D( texSampler, vTexCoord );\n"
+#endif
"}\n\0",
};
// mvp
Matrix proj, view;
- Orthographic( proj, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, false );
+
+ //float asp = (float)mImpl->defaultSurfaceRect.height / (float)mImpl->defaultSurfaceRect.width;
+
+ float shift = 0.016f;
+ Orthographic( proj, -1.0f, 1.0f, 1.0f+shift, -1.0f+shift, -1.0f, 1.0f, false );
//LookAt( view, Vector3( 0.0f, 0.0f, 0.0f ), Vector3( 0.0f, 0.0f, 1.0f ), Vector3( 0.0f, 1.0f, 0.0f ) );
//mat.SetTranslation( Vector3(0.0f, 0.0f, 1.0f ) );
Matrix::Multiply( vr.MVP, view, proj );
Integration::GlAbstraction& gl = ctx.GetAbstraction();
GL( ctx.BindFramebuffer( GL_FRAMEBUFFER, 0 ) );
gl.Viewport( 0, 0, mImpl->defaultSurfaceRect.width, mImpl->defaultSurfaceRect.height );
- //gl.Disable( GL_SCISSOR_TEST );
+ ctx.Scissor( 0, 0, mImpl->defaultSurfaceRect.width, mImpl->defaultSurfaceRect.height );
+ //DALI_LOG_ERROR("VR: %d, %d\n", (int) mImpl->defaultSurfaceRect.width, (int) mImpl->defaultSurfaceRect.height);
+
+ gl.Disable( GL_SCISSOR_TEST );
//gl.Disable( GL_DEPTH_TEST );
- //gl.ClearColor( 0.0f, f, 0.0f, 1.0f );
+ gl.ClearColor( 1.0f, 0.0f, 0.0f, 1.0f );
+ //gl.Clear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
f -= 0.2f;
if( f < 0 )
f = 1.0f;
GL( gl.DrawArrays( GL_TRIANGLES, 0, 6 ) );
#else
GL( gl.DrawElements( GL_TRIANGLES, vr.indicesCount, GL_UNSIGNED_SHORT, 0 ) );
+
#endif
if( program )
std::copy( gridVertices, gridVertices+N, vertexBuffer.data() );
std::copy( gridVertices, gridVertices+N, vertexBuffer.data()+N );
+ const float eyeseparation = 0.0f;//0.05f;
+
+ float scale = 1.0f;
// Process data for both eyes
for( size_t i = 0; i < N; i += 5 )
{
float* co = &vertexBuffer[i];
float* uv = &vertexBuffer[i+3];
-
#ifdef DEBUG_USE_HORIZONTAL_GEOMETRY
co[0] *= 0.5f;
co[0] -= 0.5f;
uv[0] *= 0.5f;
#else
- co[1] -= 1.0f;
co[1] *= 0.5f;
+ co[0] *= scale;
+ co[1] *= scale;
+ co[1] -= 0.5f;
uv[1] *= 0.5f;
#endif
+ co[1] -= eyeseparation;
}
for( size_t i = N; i < N*2; i += 5 )
{
float* co = &vertexBuffer[i];
float* uv = &vertexBuffer[i+3];
-
#ifdef DEBUG_USE_HORIZONTAL_GEOMETRY
co[0] *= 0.5f;
co[0] += 0.5f;
uv[0] *= 0.5f;
#else
- co[1] += 1.0f;
+ co[1] *= -1.0f;
co[1] *= 0.5f;
+ co[0] *= scale;
+ co[1] *= scale;
+ co[1] += 0.5f;
uv[1] += 1.0f;
+ uv[1] = 1.0f - uv[1];
uv[1] *= 0.5f;
#endif
}
#include <dali/integration-api/core.h>
#include <dali/integration-api/render-controller.h>
+#include <dali/integration-api/gyroscope-sensor.h>
#include <dali/internal/common/shader-data.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/render/gl-resources/texture-cache.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
+#include <cstdio>
+
// Un-comment to enable node tree debug logging
//#define NODE_TREE_LOGGING 1
previousUpdateScene( false ),
frameCounter( 0 ),
renderSortingHelper(),
- renderTaskWaiting( false )
+ renderTaskWaiting( false ),
+ gyroscopeSensor( NULL )
{
sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue );
GestureContainer gestures; ///< A container of owned gesture detectors
bool renderTaskWaiting; ///< A REFRESH_ONCE render task is waiting to be rendered
+
+ GyroscopeSensor* gyroscopeSensor;
};
UpdateManager::UpdateManager( NotificationManager& notificationManager,
DALI_ASSERT_DEBUG(false);
}
+void UpdateManager::SetGyroscopeSensor( Dali::Integration::GyroscopeSensor& sensor )
+{
+ mImpl->gyroscopeSensor = &sensor;
+}
+
void UpdateManager::AddTextureSet( TextureSet* textureSet )
{
DALI_ASSERT_DEBUG( NULL != textureSet );
{
class GlSyncAbstraction;
class RenderController;
-
+class GyroscopeSensor;
} // namespace Integration
namespace Internal
*/
void RemoveGesture( PanGesture* gesture );
+ // Sensors
+
+ void SetGyroscopeSensor( Dali::Integration::GyroscopeSensor& sensor );
+
// Message queue handling
/**
void Camera::Update( BufferIndex updateBufferIndex, const Node& owningNode )
{
- // if owning node has changes in world position we need to update camera for next 2 frames
- if( owningNode.IsLocalMatrixDirty() )
+ if( mType == Dali::Camera::VIRTUAL_REALITY )
{
mUpdateViewFlag = UPDATE_COUNT;
+
}
- if( owningNode.GetDirtyFlags() & VisibleFlag )
+ else
{
- // If the visibility changes, the projection matrix needs to be re-calculated.
- // It may happen the first time an actor is rendered it's rendered only once and becomes invisible,
- // in the following update the node will be skipped leaving the projection matrix (double buffered)
- // with the Identity.
- mUpdateProjectionFlag = UPDATE_COUNT;
+ // if owning node has changes in world position we need to update camera for next 2 frames
+ if( owningNode.IsLocalMatrixDirty() )
+ {
+ mUpdateViewFlag = UPDATE_COUNT;
+ }
+ if( owningNode.GetDirtyFlags() & VisibleFlag )
+ {
+ // If the visibility changes, the projection matrix needs to be re-calculated.
+ // It may happen the first time an actor is rendered it's rendered only once and becomes invisible,
+ // in the following update the node will be skipped leaving the projection matrix (double buffered)
+ // with the Identity.
+ mUpdateProjectionFlag = UPDATE_COUNT;
+ }
}
-
// if either matrix changed, we need to recalculate the inverse matrix for hit testing to work
unsigned int viewUpdateCount = UpdateViewMatrix( updateBufferIndex, owningNode );
unsigned int projectionUpdateCount = UpdateProjection( updateBufferIndex );
{
// camera orientation taken from node - i.e. look in abitrary, unconstrained direction
case Dali::Camera::FREE_LOOK:
+ case Dali::Camera::VIRTUAL_REALITY:
{
Matrix& viewMatrix = mViewMatrix.Get( updateBufferIndex );
viewMatrix = owningNode.GetWorldMatrix( updateBufferIndex );
{
FREE_LOOK, ///< Camera orientation is taken from CameraActor @SINCE_1_0.0
LOOK_AT_TARGET, ///< Camera is oriented to always look at a target @SINCE_1_0.0
+ VIRTUAL_REALITY ///< Camera uses senseors in order to maintain the orientation
};
/**