本文整理汇总了C++中Bounds3f::GetMins方法的典型用法代码示例。如果您正苦于以下问题:C++ Bounds3f::GetMins方法的具体用法?C++ Bounds3f::GetMins怎么用?C++ Bounds3f::GetMins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bounds3f
的用法示例。
在下文中一共展示了Bounds3f::GetMins方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddBounds
//==============================
// OvrDebugLinesLocal::AddBounds
void OvrDebugLinesLocal::AddBounds( Posef const & pose, Bounds3f const & bounds, Vector4f const & color )
{
Vector3f const & mins = bounds.GetMins();
Vector3f const & maxs = bounds.GetMaxs();
Vector3f corners[8];
corners[0] = mins;
corners[7] = maxs;
corners[1] = Vector3f( mins.x, maxs.y, mins.z );
corners[2] = Vector3f( mins.x, maxs.y, maxs.z );
corners[3] = Vector3f( mins.x, mins.y, maxs.z );
corners[4] = Vector3f( maxs.x, mins.y, mins.z );
corners[5] = Vector3f( maxs.x, maxs.y, mins.z );
corners[6] = Vector3f( maxs.x, mins.y, maxs.z );
// transform points
for ( int i = 0; i < 8; ++i )
{
corners[i] = pose.Orientation.Rotate( corners[i] );
corners[i] += pose.Position;
}
AddLine( corners[0], corners[1], color, color, 1, true );
AddLine( corners[1], corners[2], color, color, 1, true );
AddLine( corners[2], corners[3], color, color, 1, true );
AddLine( corners[3], corners[0], color, color, 1, true );
AddLine( corners[7], corners[6], color, color, 1, true );
AddLine( corners[6], corners[4], color, color, 1, true );
AddLine( corners[4], corners[5], color, color, 1, true );
AddLine( corners[5], corners[7], color, color, 1, true );
AddLine( corners[0], corners[4], color, color, 1, true );
AddLine( corners[1], corners[5], color, color, 1, true );
AddLine( corners[2], corners[7], color, color, 1, true );
AddLine( corners[3], corners[6], color, color, 1, true );
}
示例2: OnClick
void ScrubBarComponent::OnClick( App * app, VrFrame const & vrFrame, VRMenuEvent const & event )
{
if ( OnClickFunction == NULL )
{
return;
}
Vector3f hitPos = event.HitResult.RayStart + event.HitResult.RayDir * event.HitResult.t;
// move hit position into local space
const Posef modelPose = Background->GetWorldPose();
Vector3f localHit = modelPose.Orientation.Inverted().Rotate( hitPos - modelPose.Position );
Bounds3f bounds = Background->GetMenuObject()->GetLocalBounds( app->GetDefaultFont() ) * Background->GetParent()->GetWorldScale();
const float progress = ( localHit.x - bounds.GetMins().x ) / bounds.GetSize().x;
if ( ( progress >= 0.0f ) && ( progress <= 1.0f ) )
{
( *OnClickFunction )( this, OnClickObject, progress );
}
}
示例3: OnFrame
eMsgStatus ScrubBarComponent::OnFrame( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr,
VRMenuObject * self, VRMenuEvent const & event )
{
if ( TouchDown )
{
if ( ( vrFrame.Input.buttonState & ( BUTTON_A | BUTTON_TOUCH ) ) != 0 )
{
OnClick( app, vrFrame, event );
}
else
{
TouchDown = false;
}
}
SeekTime->SetVisible( HasFocus );
if ( HasFocus )
{
Vector3f hitPos = event.HitResult.RayStart + event.HitResult.RayDir * event.HitResult.t;
// move hit position into local space
const Posef modelPose = Background->GetWorldPose();
Vector3f localHit = modelPose.Orientation.Inverted().Rotate( hitPos - modelPose.Position );
Bounds3f bounds = Background->GetMenuObject()->GetLocalBounds( app->GetDefaultFont() ) * Background->GetParent()->GetWorldScale();
const float progress = ( localHit.x - bounds.GetMins().x ) / bounds.GetSize().x;
if ( ( progress >= 0.0f ) && ( progress <= 1.0f ) )
{
const float seekwidth = ScrubBarWidth * progress;
Vector3f pos = SeekTime->GetLocalPosition();
pos.x = PixelScale( ScrubBarWidth * -0.5f + seekwidth );
SeekTime->SetLocalPosition( pos );
SetTimeText( SeekTime, Duration * progress );
}
}
return MSG_STATUS_ALIVE;
}
示例4: CreateMenu
//.........这里部分代码省略.........
Menu->InitWithItems( menuMgr, font, 0.0f, VRMenuFlags_t(), parms );
parms.Clear();
// the centerroot item will get touch relative and touch absolute events and use them to rotate the centerRoot
menuHandle_t centerRootHandle = Menu->HandleForId( menuMgr, ID_CENTER_ROOT );
VRMenuObject * centerRoot = menuMgr.ToObject( centerRootHandle );
OVR_ASSERT( centerRoot != NULL );
// ==============================================================================
//
// title
//
{
Posef panelPose( Quatf( up, 0.0f ), Vector3f( 0.0f, 2.2f, -3.0f ) );
VRMenuObjectParms p( VRMENU_STATIC, Array< VRMenuComponent* >(),
VRMenuSurfaceParms(), Strings::ResumeMenu_Title, panelPose, defaultScale, fontParms, VRMenuId_t( ID_TITLE.Get() ),
VRMenuObjectFlags_t(), VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );
parms.PushBack( &p );
Menu->AddItems( menuMgr, font, parms, centerRootHandle, false );
parms.Clear();
}
// ==============================================================================
//
// options
//
Array<const char *> options;
options.PushBack( Strings::ResumeMenu_Resume );
options.PushBack( Strings::ResumeMenu_Restart );
Array<const char *> icons;
icons.PushBack( "assets/resume.png" );
icons.PushBack( "assets/restart.png" );
Array<PanelPose> optionPositions;
optionPositions.PushBack( PanelPose( Quatf( up, 0.0f / 180.0f * Mathf::Pi ), Vector3f( -0.5f, 1.7f, -3.0f ), Vector4f( 1.0f, 1.0f, 1.0f, 1.0f ) ) );
optionPositions.PushBack( PanelPose( Quatf( up, 0.0f / 180.0f * Mathf::Pi ), Vector3f( 0.5f, 1.7f, -3.0f ), Vector4f( 1.0f, 1.0f, 1.0f, 1.0f ) ) );
int borderWidth = 0, borderHeight = 0;
GLuint borderTexture = LoadTextureFromApplicationPackage( "assets/resume_restart_border.png", TextureFlags_t( TEXTUREFLAG_NO_DEFAULT ), borderWidth, borderHeight );
for ( int i = 0; i < optionPositions.GetSizeI(); ++i )
{
ResumeMovieComponent * resumeMovieComponent = new ResumeMovieComponent( this, i );
Array< VRMenuComponent* > optionComps;
optionComps.PushBack( resumeMovieComponent );
VRMenuSurfaceParms panelSurfParms( "",
borderTexture, borderWidth, borderHeight, SURFACE_TEXTURE_ADDITIVE,
0, 0, 0, SURFACE_TEXTURE_MAX,
0, 0, 0, SURFACE_TEXTURE_MAX );
Posef panelPose( optionPositions[ i ].Orientation, optionPositions[ i ].Position );
VRMenuObjectParms * p = new VRMenuObjectParms( VRMENU_BUTTON, optionComps,
panelSurfParms, options[ i ], panelPose, defaultScale, fontParms, VRMenuId_t( ID_OPTIONS.Get() + i ),
VRMenuObjectFlags_t(), VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );
parms.PushBack( p );
Menu->AddItems( menuMgr, font, parms, centerRootHandle, false );
DeletePointerArray( parms );
parms.Clear();
// add icon
menuHandle_t optionHandle = centerRoot->ChildHandleForId( menuMgr, VRMenuId_t( ID_OPTIONS.Get() + i ) );
VRMenuObject * optionObject = menuMgr.ToObject( optionHandle );
OVR_ASSERT( optionObject != NULL );
int iconWidth = 0, iconHeight = 0;
GLuint iconTexture = LoadTextureFromApplicationPackage( icons[ i ], TextureFlags_t( TEXTUREFLAG_NO_DEFAULT ), iconWidth, iconHeight );
VRMenuSurfaceParms iconSurfParms( "",
iconTexture, iconWidth, iconHeight, SURFACE_TEXTURE_DIFFUSE,
0, 0, 0, SURFACE_TEXTURE_MAX,
0, 0, 0, SURFACE_TEXTURE_MAX );
Bounds3f textBounds = optionObject->GetTextLocalBounds( font );
optionObject->SetTextLocalPosition( Vector3f( iconWidth * VRMenuObject::DEFAULT_TEXEL_SCALE * 0.5f, 0.0f, 0.0f ) );
Posef iconPose( optionPositions[ i ].Orientation, optionPositions[ i ].Position + Vector3f( textBounds.GetMins().x, 0.0f, 0.01f ) );
p = new VRMenuObjectParms( VRMENU_STATIC, Array< VRMenuComponent* >(),
iconSurfParms, NULL, iconPose, defaultScale, fontParms, VRMenuId_t( ID_OPTION_ICONS.Get() + i ),
VRMenuObjectFlags_t( VRMENUOBJECT_DONT_HIT_ALL ), VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );
parms.PushBack( p );
Menu->AddItems( menuMgr, font, parms, centerRootHandle, false );
DeletePointerArray( parms );
parms.Clear();
menuHandle_t iconHandle = centerRoot->ChildHandleForId( menuMgr, VRMenuId_t( ID_OPTION_ICONS.Get() + i ) );
resumeMovieComponent->Icon = menuMgr.ToObject( iconHandle );
}
Cinema.app->GetGuiSys().AddMenu( Menu );
}