当前位置: 首页>>代码示例>>C++>>正文


C++ Fvector函数代码示例

本文整理汇总了C++中Fvector函数的典型用法代码示例。如果您正苦于以下问题:C++ Fvector函数的具体用法?C++ Fvector怎么用?C++ Fvector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Fvector函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Fvector

bool CIKFoot::make_shift( Fmatrix &xm,const Fvector &cl_point, bool collide, const Fplane &p, const Fvector &pick_dir )const
{
	Fvector shift = pick_dir;

	//Fvector toe; ToePosition( toe ); xm.transform_tiny( toe );
	Fvector point;
	xm.transform_tiny( point, cl_point );
	float dot = p.n.dotproduct( shift );
	if( _abs( dot ) < min_dot )
	{
		shift.add( Fvector( ).mul( p.n, min_dot - _abs( dot ) ) );
		dot = p.n.dotproduct( shift );
	}
	VERIFY( !fis_zero( dot ) );
	float shift_m = ( -p.d - p.n.dotproduct( point ) )/dot;
	if(collide && shift_m > 0.f )
		return false;
	clamp( shift_m, -collide_dist, collide_dist );
	shift.mul( shift_m );
	xm.c.add( shift );
#if	0
	if(shift_m > 0.f)
	{
		DBG_OpenCashedDraw();
		DBG_DrawLine( toe, Fvector().add( toe, shift ), D3DCOLOR_XRGB( 255, 255, 255 )  );
		DBG_ClosedCashedDraw( 1000 );
	}
#endif
	return true;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:30,代码来源:IKFoot.cpp

示例2: 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));
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:26,代码来源:GameObject.cpp

示例3: ToePosition

void	CIKFoot::SetFootGeom		( ik_foot_geom &fg, const Fmatrix &ref_bone, const Fmatrix& object_matrix ) const
{
	Fmatrix gl_bone; gl_bone.mul_43( object_matrix, ref_bone );

	Fvector pos_toe; ToePosition( pos_toe );
	gl_bone.transform_tiny( pos_toe );

	Fvector heel;  Fvector	 pos_hill;
	Fmatrix foot =( Fmatrix( ).mul_43( object_matrix, ref_bone_to_foot( foot, ref_bone ) ) );
	foot.transform_tiny( pos_hill, HeelPosition( heel ) );
	const Fvector v_m = Fvector().add(pos_toe, pos_hill ).mul(0.5f) ;
	
	Fvector normal, direction;
	get_local_vector( normal, m_foot_normal );
	get_local_vector( direction, m_foot_direction );
	
	Fvector v_side =  Fvector().crossproduct( normal, direction );
	gl_bone.transform_dir ( v_side );
	float vsm = v_side.magnitude();
	VERIFY( vsm > EPS_L );
	v_side.mul( Fvector().sub(pos_toe, pos_hill ).magnitude()/vsm );

	fg.set( pos_toe, pos_hill, Fvector().add( v_m, v_side ) ); 

}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:25,代码来源:IKFoot.cpp

示例4: float

BOOL CPPEffectorControllerAura::update()
{
	// update factor
	if (m_effector_state == eStatePermanent) {
		m_factor = 1.f;
	} else {
		m_factor = float(Device.dwTimeGlobal - m_time_state_started) / float(m_time_to_fade);
		if (m_effector_state == eStateFadeOut) m_factor = 1 - m_factor;

		if (m_factor > 1) {
			m_effector_state	= eStatePermanent;
			m_factor			= 1.f;
		} else if (m_factor < 0) {
			if (m_snd_left._feedback())		m_snd_left.stop();
			if (m_snd_right._feedback())	m_snd_right.stop();
		
			return FALSE;
		}
	}

	// start new or play again?
	if (!m_snd_left._feedback() && !m_snd_right._feedback()) {
		m_snd_left.play_at_pos	(Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_Looped | sm_2D);
		m_snd_right.play_at_pos	(Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_Looped | sm_2D);
	} 

	if (m_snd_left._feedback())		m_snd_left.set_volume	(m_factor);
	if (m_snd_right._feedback())	m_snd_right.set_volume	(m_factor);

	return TRUE;
}
开发者ID:2asoft,项目名称:xray,代码行数:31,代码来源:controller_psy_aura.cpp

示例5: switch

void CCustomDetector::OnStateSwitch(u32 S)
{
	inherited::OnStateSwitch(S);

	switch(S)
	{
	case eShowing:
		{
			g_player_hud->attach_item	(this);
			m_sounds.PlaySound			("sndShow", Fvector().set(0,0,0), this, true, false);
			PlayHUDMotion				(m_bFastAnimMode?"anm_show_fast":"anm_show", TRUE, this, GetState());
			SetPending					(TRUE);
		}break;
	case eHiding:
		{
			m_sounds.PlaySound			("sndHide", Fvector().set(0,0,0), this, true, false);
			PlayHUDMotion				(m_bFastAnimMode?"anm_hide_fast":"anm_hide", TRUE, this, GetState());
			SetPending					(TRUE);
		}break;
	case eIdle:
		{
			PlayAnimIdle				();
			SetPending					(FALSE);
		}break;
}
}
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:26,代码来源:CustomDetector.cpp

示例6: Fvector

void CControllerPsyHit::set_sound_state(ESoundState state)
{
	CController *monster = smart_cast<CController *>(m_object);
	if (state == ePrepare) {
		monster->m_sound_tube_prepare.play_at_pos(Actor(), Fvector().set(0.f, 0.f, 0.f), sm_2D);
	} else 
	if (state == eStart) {
		if (monster->m_sound_tube_prepare._feedback())	monster->m_sound_tube_prepare.stop();

		monster->m_sound_tube_start.play_at_pos(Actor(), Fvector().set(0.f, 0.f, 0.f), sm_2D);
		monster->m_sound_tube_pull.play_at_pos(Actor(), Fvector().set(0.f, 0.f, 0.f), sm_2D);
	} else 
	if (state == eHit) {
		if (monster->m_sound_tube_start._feedback())	monster->m_sound_tube_start.stop();
		if (monster->m_sound_tube_pull._feedback())		monster->m_sound_tube_pull.stop();
		
		//monster->m_sound_tube_hit_left.play_at_pos(Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_2D);
		//monster->m_sound_tube_hit_right.play_at_pos(Actor(), Fvector().set(1.f, 0.f, 1.f), sm_2D);
	} else 
	if (state == eNone) {
		if (monster->m_sound_tube_start._feedback())	monster->m_sound_tube_start.stop();
		if (monster->m_sound_tube_pull._feedback())		monster->m_sound_tube_pull.stop();
		if (monster->m_sound_tube_prepare._feedback())	monster->m_sound_tube_prepare.stop();
	}

	m_sound_state = state;
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:27,代码来源:controller_psy_hit.cpp

示例7: operator

	void operator () (const Fvector& p)
	{
		Fvector lpos;
		i_bind_transform.transform_tiny(lpos, p );
		//Fvector diff;diff.sub( lpos, pos );
		if( Fvector().sub( lpos, start_pos ).dotproduct( ax ) > Fvector().sub( pos, start_pos ).dotproduct( ax ) )
						pos.set( lpos );
	}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:8,代码来源:IKFoot.cpp

示例8: trace

bool CSnork::trace_geometry(const Fvector &d, float &range)
{
	Fvector				dir;
	float				h, p;

	Fvector				Pl,Pc,Pr;
	Fvector				center;
	Center				(center);

	range				= trace (d);
	if (range > TRACE_RANGE) return false;
	
	float angle			= asin(1.f / range);

	// trace center ray
	dir					= d;

	dir.getHP			(h,p);
	p					+= angle;
	dir.setHP			(h,p);
	dir.normalize_safe	();

	range				= trace (dir);
	if (range > TRACE_RANGE) return false;

	Pc.mad				(center, dir, range);

	// trace left ray
	Fvector				temp_p;
	temp_p.mad			(Pc, XFORM().i, Radius() / 2);
	dir.sub				(temp_p, center);
	dir.normalize_safe	();

	range				= trace (dir);
	if (range > TRACE_RANGE) return false;

	Pl.mad				(center, dir, range);

	// trace right ray
	Fvector inv			= XFORM().i; 
	inv.invert			();
	temp_p.mad			(Pc, inv, Radius() / 2);
	dir.sub				(temp_p, center);
	dir.normalize_safe	();

	range				= trace (dir);
	if (range > TRACE_RANGE) return false;

	Pr.mad				(center, dir, range);

	float				h1,p1,h2,p2;

	Fvector().sub(Pl, Pc).getHP(h1,p1);
	Fvector().sub(Pc, Pr).getHP(h2,p2);

	return (fsimilar(h1,h2,0.1f) && fsimilar(p1,p2,0.1f));
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:57,代码来源:snork.cpp

示例9: ik_pick_result

	ik_pick_result(ik_foot_geom::e_collide_point _point): 
		p(invalide_plane),
		point( _point ),
		position( Fvector().set( -FLT_MAX, -FLT_MAX, -FLT_MAX ) )
	{
		triangle[0] = Fvector().set( -FLT_MAX, -FLT_MAX, -FLT_MAX );
		triangle[1] = Fvector().set( -FLT_MAX, -FLT_MAX, -FLT_MAX );
		triangle[2] = Fvector().set( -FLT_MAX, -FLT_MAX, -FLT_MAX );
	}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:9,代码来源:ik_foot_collider.cpp

示例10: Level

void CControlManagerCustom::check_jump_over_physics()
{
	if (!m_man->path_builder().is_moving_on_path()) return;
	if (!m_man->check_start_conditions(ControlCom::eControlJump)) return;
	if (!m_object->check_start_conditions(ControlCom::eControlJump)) return;
	if (m_object->GetScriptControl()) return;

	Fvector prev_pos	= m_object->Position();
	float	dist_sum	= 0.f;

	for(u32 i = m_man->path_builder().detail().curr_travel_point_index(); i<m_man->path_builder().detail().path().size();i++) {
		const DetailPathManager::STravelPathPoint &travel_point = m_man->path_builder().detail().path()[i];

		// получить список объектов вокруг врага
		m_nearest.clear_not_free		();
		Level().ObjectSpace.GetNearest	(m_nearest,travel_point.position, m_object->Radius(), NULL);

		for (u32 k=0;k<m_nearest.size();k++) {
			CPhysicsShellHolder *obj = smart_cast<CPhysicsShellHolder *>(m_nearest[k]);
			if (!obj || !obj->PPhysicsShell() || !obj->PPhysicsShell()->isActive() || (obj->Radius() < 0.5f)) continue;
			if (m_object->Position().distance_to(obj->Position()) < MAX_DIST_SUM / 2) continue;

			Fvector dir = Fvector().sub(travel_point.position, m_object->Position());

			// проверка на  Field-Of-View
			float	my_h	= m_object->Direction().getH();
			float	h		= dir.getH();

			float from	= angle_normalize(my_h - deg(8));
			float to	= angle_normalize(my_h + deg(8));

			if (!is_angle_between(h, from, to)) continue;

			dir = Fvector().sub(obj->Position(), m_object->Position());

			// вычислить целевую позицию для прыжка
			Fvector target;
			obj->Center(target);
			target.y += obj->Radius();
			// --------------------------------------------------------

			m_jump->setup_data().flags.set			(SControlJumpData::ePrepareSkip, true);
			m_jump->setup_data().target_object		= 0;
			m_jump->setup_data().target_position	= target;

			jump(m_jump->setup_data());

			return;
		}

		dist_sum += prev_pos.distance_to(travel_point.position);
		if (dist_sum > MAX_DIST_SUM) break;

		prev_pos = travel_point.position;
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:56,代码来源:control_manager_custom.cpp

示例11: CreateHit

void CRadioactiveZone::feel_touch_new					(CObject* O	)
{
	inherited::feel_touch_new(O);
	if (GameID() != GAME_SINGLE)
	{
		if (O->CLS_ID == CLSID_OBJECT_ACTOR)
		{
			CreateHit(O->ID(),ID(),Fvector().set(0, 0, 0),0.0f,BI_NONE,Fvector().set(0, 0, 0),0.0f,ALife::eHitTypeRadiation);
		}
	};
};
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:11,代码来源:RadioactiveZone.cpp

示例12: CreateHit

void CRadioactiveZone::feel_touch_new					(CObject* O	)
{
	inherited::feel_touch_new(O);
	if (GameID() != eGameIDSingle)
	{
		if (smart_cast<CActor*>(O))
		{
			CreateHit(O->ID(),ID(),Fvector().set(0, 0, 0),0.0f,BI_NONE,Fvector().set(0, 0, 0),0.0f,m_eHitTypeBlowout);// ALife::eHitTypeRadiation
		}
	};
};
开发者ID:BeaconDev,项目名称:xray-16,代码行数:11,代码来源:RadioactiveZone.cpp

示例13: VERIFY

void ESceneObjectTools::HighlightTexture(LPCSTR tex_name, bool allow_ratio, u32 t_width, u32 t_height, BOOL mark)
{
	if (tex_name&&tex_name[0]){
        for (ObjectIt a_it=m_Objects.begin(); a_it!=m_Objects.end(); a_it++){
            CSceneObject* s_obj		= dynamic_cast<CSceneObject*>(*a_it);
            CEditableObject* e_obj	= s_obj->GetReference(); VERIFY(e_obj);
            SurfaceVec& s_vec		= e_obj->Surfaces();
            for (SurfaceIt it=s_vec.begin(); it!=s_vec.end(); it++){
                if (0==stricmp((*it)->_Texture(),tex_name)){
					Fvector 		verts[3];
					for (EditMeshIt mesh_it=e_obj->FirstMesh(); mesh_it!=e_obj->LastMesh(); mesh_it++){
                    	SurfFaces& 		surf_faces	= (*mesh_it)->GetSurfFaces();
                    	SurfFacesPairIt sf_it 		= surf_faces.find(*it);
                        if (sf_it!=surf_faces.end()){
                            IntVec& lst				= sf_it->second;
                            for (IntIt i_it=lst.begin(); i_it!=lst.end(); i_it++){
                                e_obj->GetFaceWorld	(s_obj->_Transform(),*mesh_it,*i_it,verts);
                                u32 clr	= 0x80FFFFFF;
                                if (allow_ratio){
                                	// select color
                                    const Fvector2* tc[3];
                                    Fvector 		c,e01,e02;
                                    e01.sub			(verts[1],verts[0]);
                                    e02.sub			(verts[2],verts[0]);
                                    float area		= c.crossproduct(e01,e02).magnitude()/2.f;
                                    (*mesh_it)->GetFaceTC(*i_it,tc);
                                    e01.sub			(Fvector().set(tc[1]->x,tc[1]->y,0),Fvector().set(tc[0]->x,tc[0]->y,0));
                                    e02.sub			(Fvector().set(tc[2]->x,tc[2]->y,0),Fvector().set(tc[0]->x,tc[0]->y,0));
                                    float p_area	= c.crossproduct(e01,e02).magnitude()/2.f;
                                    float ratio		= _sqrt((p_area*t_width*t_height)/area);
                                    int idx_clr		= 4;
                                    float w			= 0.f;
                                    if (ratio>=0.f && ratio<50.f) 			{idx_clr=0; w=ratio/30.f;}
                                    else if (ratio>=50.f && ratio<150.f) 	{idx_clr=1; w=(ratio-30.f)/150.f;}
                                    else if (ratio>=150.f && ratio<250.f) 	{idx_clr=2; w=(ratio-150.f)/250.f;}
                                    else if (ratio>=250.f && ratio<500.f) 	{idx_clr=3; w=(ratio-250.f)/500.f;}
                                    float inv_w		= 1.f-w;
                                    clr				= color_rgba(color_get_R(ratio_colors[idx_clr+0])*inv_w+color_get_R(ratio_colors[idx_clr+1])*w,
                                    							 color_get_G(ratio_colors[idx_clr+0])*inv_w+color_get_G(ratio_colors[idx_clr+1])*w,
                                                                 color_get_B(ratio_colors[idx_clr+0])*inv_w+color_get_B(ratio_colors[idx_clr+1])*w,
                                                                 color_get_A(ratio_colors[idx_clr+0])*inv_w+color_get_A(ratio_colors[idx_clr+1])*w);
                                }
                                Tools->m_DebugDraw.AppendSolidFace(verts[0],verts[1],verts[2],clr,false);
                                if (mark)	Tools->m_DebugDraw.AppendWireFace(verts[0],verts[1],verts[2],clr,false);
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:2asoft,项目名称:xray,代码行数:52,代码来源:ESceneObjectTools__.cpp

示例14: inherited

CPPEffectorControllerAura::CPPEffectorControllerAura(const SPPInfo &ppi, u32 time_to_fade, const ref_sound &snd_left, const ref_sound &snd_right)
: inherited(ppi)
{
	m_time_to_fade			= time_to_fade;
	m_effector_state		= eStateFadeIn;
	m_time_state_started	= Device.dwTimeGlobal;

	m_snd_left.clone		(snd_left,st_Effect,sg_SourceType);	
	m_snd_right.clone		(snd_right,st_Effect,sg_SourceType);	

	m_snd_left.play_at_pos	(Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_Looped | sm_2D);
	m_snd_right.play_at_pos	(Actor(), Fvector().set(-1.f, 0.f, 1.f), sm_Looped | sm_2D);

}
开发者ID:2asoft,项目名称:xray,代码行数:14,代码来源:controller_psy_aura.cpp

示例15: VERIFY

void CElevatorState::UpdateStClimbingDown()
{
	VERIFY(m_ladder&&m_character);
	Fvector d;
	
	if(ClimbDirection()>0.f&&m_ladder->BeforeLadder(m_character))
		SwitchState(clbClimbingUp);
	float to_ax=m_ladder->DDToAxis(m_character,d);
	Fvector ca;ca.set(m_character->ControlAccel());
	float  control_a=to_mag_and_dir(ca);
	if(!fis_zero(to_ax)&&!fis_zero(control_a)&&abs(-ca.dotproduct(Fvector(m_ladder->Norm()).normalize()))<M_SQRT1_2)SwitchState(clbDepart);
	if(m_ladder->AxDistToLowerP(m_character)-m_character->FootRadius()<stop_climbing_dist)
		SwitchState(clbNearDown);
	UpdateClimbingCommon(d,to_ax,ca,control_a);

	if(m_ladder->AxDistToUpperP(m_character)<-m_character->FootRadius())SwitchState(clbNoLadder);

	Fvector vel;
	m_character->GetVelocity(vel);
	if(vel.y>EPS_S)
	{
		m_character->ApplyForce(0.f,-m_character->Mass()*ph_world->Gravity(),0.f);
	}
	//if(to_ax-m_character->FootRadius()>out_dist)
	//														SwitchState((clbNone));
	//if(fis_zero(control_a)) 
	//	m_character->ApplyForce(d,m_character->Mass());
}
开发者ID:2asoft,项目名称:xray,代码行数:28,代码来源:ElevatorState.cpp


注:本文中的Fvector函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。