本文整理汇总了C++中Visual函数的典型用法代码示例。如果您正苦于以下问题:C++ Visual函数的具体用法?C++ Visual怎么用?C++ Visual使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Visual函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Level
void CGameObject::OnRender ()
{
if (!ai().get_level_graph())
return;
CDebugRenderer &renderer = Level().debug_renderer();
if (/**bDebug && /**/Visual()) {
float half_cell_size = 1.f*ai().level_graph().header().cell_size()*.5f;
Fvector additional = Fvector().set(half_cell_size,half_cell_size,half_cell_size);
render_box (Visual(),XFORM(),Fvector().set(0.f,0.f,0.f),true,color_rgba(0,0,255,255));
render_box (Visual(),XFORM(),additional,false,color_rgba(0,255,0,255));
}
if (0) {
Fvector bc,bd;
Visual()->getVisData().box.get_CD (bc,bd);
Fmatrix M = Fidentity;
float half_cell_size = ai().level_graph().header().cell_size()*.5f;
bd.add (Fvector().set(half_cell_size,half_cell_size,half_cell_size));
M.scale (bd);
Fmatrix T = XFORM();
T.c.add (bc);
renderer.draw_obb (T,bd,color_rgba(255,255,255,255));
}
}
示例2: xr_delete
void CPhysicObject::create_collision_model ( )
{
xr_delete( collidable.model );
VERIFY( Visual() );
IKinematics *K = Visual()->dcast_PKinematics ();
VERIFY( K );
CInifile* ini = K->LL_UserData();
if( ini && ini->section_exist( "collide" ) && ini->line_exist("collide", "mesh" ) && ini->r_bool("collide", "mesh" ) )
{
collidable.model = xr_new<CCF_DynamicMesh>( this );
return;
}
collidable.model = xr_new<CCF_Skeleton>(this);
/*
switch(m_type) {
case epotBox:
case epotFixedChain:
case epotFreeChain :
case epotSkeleton : collidable.model = xr_new<CCF_Skeleton>(this); break;
default: NODEFAULT;
}
*/
}
示例3: Visual
void CGameObject::renderable_Render ()
{
inherited::renderable_Render();
::Render->set_Transform (&XFORM());
::Render->add_Visual (Visual());
Visual()->getVisData().hom_frame = Device.dwFrame;
}
示例4: activate_physic_shell
void CPhysicsShellHolder::activate_physic_shell()
{
VERIFY (!m_pPhysicsShell);
create_physic_shell ();
Fvector l_fw, l_up;
l_fw.set (XFORM().k);
l_up.set (XFORM().j);
l_fw.mul (2.f);
l_up.mul (2.f);
Fmatrix l_p1, l_p2;
l_p1.set (XFORM());
l_p2.set (XFORM());
l_fw.mul (2.f);
l_p2.c.add (l_fw);
m_pPhysicsShell->Activate (l_p1, 0, l_p2);
if(H_Parent()&&H_Parent()->Visual())
{
smart_cast<CKinematics*>(H_Parent()->Visual())->CalculateBones_Invalidate ();
smart_cast<CKinematics*>(H_Parent()->Visual())->CalculateBones ();
}
smart_cast<CKinematics*>(Visual())->CalculateBones_Invalidate ();
smart_cast<CKinematics*>(Visual())->CalculateBones();
if(!IsGameTypeSingle())
{
if(!smart_cast<CCustomRocket*>(this)&&!smart_cast<CGrenade*>(this)) PPhysicsShell()->SetIgnoreDynamic();
}
// XFORM().set (l_p1);
correct_spawn_pos();
m_pPhysicsShell->set_LinearVel(l_fw);
m_pPhysicsShell->GetGlobalTransformDynamic(&XFORM());
}
示例5: Count
THuiRealRect CHuiLayout::BoundingRect() const
{
THuiRealPoint min;
THuiRealPoint max;
min.iX = 0;
min.iY = 0;
max.iX = 0;
max.iY = 0;
TInt count = Count();
if(count > 0)
{
min = Visual(0).Pos().Target();
max = min + Visual(0).Size().Target();
}
for(TInt i = 1; i < count; ++i)
{
THuiRealPoint tl = Visual(i).Pos().Target();
THuiRealPoint br = tl + Visual(i).Size().Target();
min.iX = Min(min.iX, tl.iX);
min.iY = Min(min.iY, tl.iY);
max.iX = Max(max.iX, br.iX);
max.iY = Max(max.iY, br.iY);
}
return THuiRealRect(min, max);
}
示例6: Visual
void CCar::CreateSkeleton(CSE_Abstract *po)
{
if (!Visual()) return;
IRenderVisual *pVis = Visual();
IKinematics* pK = smart_cast<IKinematics*>(pVis);
IKinematicsAnimated* pKA = smart_cast<IKinematicsAnimated*>(pVis);
if(pKA)
{
pKA->PlayCycle ("idle");
pK->CalculateBones (TRUE);
}
phys_shell_verify_object_model ( *this );
#pragma todo(" replace below by P_build_Shell or call inherited")
m_pPhysicsShell = P_create_Shell();
m_pPhysicsShell->build_FromKinematics(pK,&bone_map);
m_pPhysicsShell->set_PhysicsRefObject(this);
m_pPhysicsShell->mXFORM.set(XFORM());
m_pPhysicsShell->Activate(true);
m_pPhysicsShell->SetAirResistance(0.f,0.f);
m_pPhysicsShell->SetPrefereExactIntegration();
ApplySpawnIniToPhysicShell(&po->spawn_ini(),m_pPhysicsShell,false);
ApplySpawnIniToPhysicShell(pK->LL_UserData(),m_pPhysicsShell,false);
}
示例7:
void CGameObject::SetKinematicsCallback (bool set)
{
if(!Visual()) return;
if (set)
smart_cast<IKinematics*>(Visual())->Callback(VisualCallback,this);
else
smart_cast<IKinematics*>(Visual())->Callback(0,0);
};
示例8: SelectAnimation
void CAI_Rat::SelectAnimation(const Fvector& /**_view/**/, const Fvector& /**_move/**/, float /**speed/**/)
{
IKinematicsAnimated *tpVisualObject = smart_cast<IKinematicsAnimated*>(Visual());
MotionID tpGlobalAnimation;
if (!g_Alive()) {
for (int i=0 ;i<2; ++i) {
if (m_tRatAnimations.tNormal.tGlobal.tpaDeath[i] == m_tpCurrentGlobalAnimation) {
tpGlobalAnimation = m_tpCurrentGlobalAnimation;
break;
}
}
if (!tpGlobalAnimation) {
if (m_tpCurrentGlobalAnimation == m_tRatAnimations.tNormal.tGlobal.tpaIdle[1])
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaDeath[0];
else
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaDeath[::Random.randI(0,2)];
}
}
else {
if (m_bFiring)
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaAttack[2];
else
if (angle_difference(movement().m_body.target.yaw,movement().m_body.current.yaw) <= MIN_TURN_ANGLE)
if (m_fSpeed < 0.2f) {
if (m_bStanding)
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaIdle[1];
else
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaIdle[0];
}
else
if (_abs(m_fSpeed - m_fAttackSpeed) < EPS_L)
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tRunAttack;
else
if (_abs(m_fSpeed - m_fMaxSpeed) < EPS_L)
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tRun.fwd;
else
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tWalk.fwd;
else {
if (left_angle(-movement().m_body.target.yaw,-movement().m_body.current.yaw))
// tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaIdle[0];
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpTurnLeft;
else
// tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpaIdle[0];
tpGlobalAnimation = m_tRatAnimations.tNormal.tGlobal.tpTurnRight;
}
}
if (tpGlobalAnimation != m_tpCurrentGlobalAnimation)
m_tpCurrentGlobalBlend = tpVisualObject->PlayCycle(m_tpCurrentGlobalAnimation = tpGlobalAnimation);
#ifdef DEBUG
if (psAI_Flags.is(aiAnimation)) {
IKinematicsAnimated *skeleton_animated = smart_cast<IKinematicsAnimated*>(Visual());
Msg ("%6d %s animation : %s (%f,%f)",Device.dwTimeGlobal,"Global",skeleton_animated->LL_MotionDefName_dbg(m_tpCurrentGlobalAnimation),movement().m_body.current.yaw,movement().m_body.target.yaw);
}
#endif
}
示例9: ApplySpawnIniToPhysicShell
void CPhysicObject::CreateSkeleton(CSE_ALifeObjectPhysic* po)
{
if(m_pPhysicsShell) return;
if(!Visual()) return;
LPCSTR fixed_bones=*po->fixed_bones;
m_pPhysicsShell=P_build_Shell(this,!po->_flags.test(CSE_PHSkeleton::flActive),fixed_bones);
ApplySpawnIniToPhysicShell(&po->spawn_ini(),m_pPhysicsShell,fixed_bones[0]!='\0');
ApplySpawnIniToPhysicShell(smart_cast<IKinematics*>(Visual())->LL_UserData(),m_pPhysicsShell,fixed_bones[0]!='\0');
}
示例10: ResetBoneCallbacks
void CWeaponStatMgun::ResetBoneCallbacks()
{
CBoneInstance& biX = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_x_bone);
biX.reset_callback ();
CBoneInstance& biY = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_y_bone);
biY.reset_callback ();
m_pPhysicsShell->EnabledCallbacks(TRUE);
}
示例11:
void CPhysicsShellHolder::setup_physic_shell ()
{
VERIFY (!m_pPhysicsShell);
create_physic_shell ();
m_pPhysicsShell->Activate (XFORM(),0,XFORM());
smart_cast<CKinematics*>(Visual())->CalculateBones_Invalidate ();
smart_cast<CKinematics*>(Visual())->CalculateBones();
m_pPhysicsShell->GetGlobalTransformDynamic(&XFORM());
}
示例12: SetBoneCallbacks
void CWeaponStatMgun::SetBoneCallbacks()
{
m_pPhysicsShell->EnabledCallbacks(FALSE);
CBoneInstance& biX = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_x_bone);
biX.set_callback (bctCustom,BoneCallbackX,this);
CBoneInstance& biY = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_y_bone);
biY.set_callback (bctCustom,BoneCallbackY,this);
}
示例13: if
void CActor::steer_Vehicle(float angle)
{
if(!m_holder) return;
CCar* car = smart_cast<CCar*>(m_holder);
u16 anim_type = car->DriverAnimationType();
SVehicleAnimCollection& anims=m_vehicle_anims->m_vehicles_type_collections[anim_type];
if(angle==0.f) smart_cast<CKinematicsAnimated*> (Visual())->PlayCycle(anims.idles[0]);
else if(angle>0.f) smart_cast<CKinematicsAnimated*> (Visual())->PlayCycle(anims.steer_right);
else smart_cast<CKinematicsAnimated*> (Visual())->PlayCycle(anims.steer_left);
}
示例14: PPhysicsShell
void CHelicopter::UpdateCL()
{
inherited::UpdateCL ();
CExplosive::UpdateCL();
if(PPhysicsShell() && (state() == CHelicopter::eDead) ) {
PPhysicsShell()->InterpolateGlobalTransform(&XFORM());
IKinematics* K = smart_cast<IKinematics*>(Visual());
K->CalculateBones ();
//smoke
UpdateHeliParticles();
if(m_brokenSound._feedback())
m_brokenSound.set_position(XFORM().c);
return;
}
else
PPhysicsShell()->SetTransform(XFORM(), mh_unspecified );
m_movement.Update();
m_stepRemains+=Device.fTimeDelta;
while(m_stepRemains>STEP) {
MoveStep();
m_stepRemains-=STEP;
}
#ifdef DEBUG
if(bDebug) {
CGameFont* F = UI().Font().pFontDI;
F->SetAligment (CGameFont::alCenter);
// F->SetSizeI (0.02f);
F->OutSetI (0.f,-0.8f);
F->SetColor (0xffffffff);
F->OutNext ("Heli: speed=%4.4f acc=%4.4f dist=%4.4f",m_movement.curLinearSpeed, m_movement.curLinearAcc, m_movement.GetDistanceToDestPosition());
}
#endif
if(m_engineSound._feedback())
m_engineSound.set_position(XFORM().c);
m_enemy.Update();
//weapon
UpdateWeapons();
UpdateHeliParticles();
IKinematics* K = smart_cast<IKinematics*>(Visual());
K->CalculateBones ();
}
示例15: character_physics_support
void CActor::HitSignal(float perc, Fvector& vLocalDir, CObject* who, s16 element)
{
if (g_Alive())
{
// stop-motion
if (character_physics_support()->movement()->Environment()==CPHMovementControl::peOnGround || character_physics_support()->movement()->Environment()==CPHMovementControl::peAtWall)
{
Fvector zeroV;
zeroV.set (0,0,0);
character_physics_support()->movement()->SetVelocity(zeroV);
}
// check damage bone
Fvector D;
XFORM().transform_dir(D,vLocalDir);
float yaw, pitch;
D.getHP(yaw,pitch);
CKinematicsAnimated *tpKinematics = smart_cast<CKinematicsAnimated*>(Visual());
VERIFY(tpKinematics);
#pragma todo("Dima to Dima : forward-back bone impulse direction has been determined incorrectly!")
MotionID motion_ID = m_anims->m_normal.m_damage[iFloor(tpKinematics->LL_GetBoneInstance(element).get_param(1) + (angle_difference(r_model_yaw + r_model_yaw_delta,yaw) <= PI_DIV_2 ? 0 : 1))];
float power_factor = perc/100.f; clamp(power_factor,0.f,1.f);
VERIFY(motion_ID.valid());
tpKinematics->PlayFX(motion_ID,power_factor);
}
}