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


C++ Fvector::normalize_magn方法代码示例

本文整理汇总了C++中Fvector::normalize_magn方法的典型用法代码示例。如果您正苦于以下问题:C++ Fvector::normalize_magn方法的具体用法?C++ Fvector::normalize_magn怎么用?C++ Fvector::normalize_magn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fvector的用法示例。


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

示例1: Render

void CLight::Render(int priority, bool strictB2F)
{
	inherited::Render(priority,strictB2F);
    if ((1==priority)&&(false==strictB2F)){
        Device.SetShader		(Device.m_WireShader);
        RCache.set_xform_world	(Fidentity);
    	u32 clr = Locked()?LOCK_COLOR:(Selected()?SEL_COLOR:(m_Flags.is(ELight::flAffectDynamic)?NORM_DYN_COLOR:NORM_COLOR));
    	switch (m_Type){
        case ELight::ltPoint:
            if (Selected()) 	DU.DrawLineSphere( PPosition, m_Range, clr, true );
            DU.DrawPointLight(PPosition,VIS_RADIUS, clr);
            if (m_Flags.is(ELight::flPointFuzzy)){
            	VERIFY(m_FuzzyData);
			    for (FvectorIt it=m_FuzzyData->m_Positions.begin(); it!=m_FuzzyData->m_Positions.end(); it++){
                	Fvector tmp; _Transform().transform_tiny(tmp,*it);
		            DU.DrawPointLight(tmp,VIS_RADIUS/6, clr);
	            }
			}
        break;
        case ELight::ltSpot:{
//			Fvector dir;
//			dir.setHP		(PRotation.y,PRotation.x);
//			DU.DrawCone		(Fidentity, PPosition, dir, Selected()?m_Range:VIS_RADIUS, radius2, clr, true, false);
        	if (Selected())	DU.DrawSpotLight( PPosition, FTransformR.k, m_Range, m_Cone, clr );
            else			DU.DrawSpotLight( PPosition, FTransformR.k, VIS_RADIUS, m_Cone, clr );
        }break;
        default: THROW;
        }
    	ESceneLightTools* lt = dynamic_cast<ESceneLightTools*>(ParentTools); VERIFY(lt);
        if (lt->m_Flags.is(ESceneLightTools::flShowControlName)){ 
            Fvector D;	D.sub(Device.vCameraPosition,PPosition);
            float dist 	= D.normalize_magn();
        	if (!Scene->RayPickObject(dist,PPosition,D,OBJCLASS_SCENEOBJECT,0,0))
	        	DU.OutText (PPosition,AnsiString().sprintf(" %s",GetLControlName()).c_str(),0xffffffff,0xff000000);
        }
    }else if ((1==priority)&&(true==strictB2F)){
        Device.SetShader		(Device.m_SelectionShader);
        RCache.set_xform_world	(Fidentity);
    	switch (m_Type){
        case ELight::ltPoint:
            if (m_Flags.is(ELight::flPointFuzzy)){
		    	u32 clr = Locked()?LOCK_COLOR:(Selected()?SEL_COLOR:(m_Flags.is(ELight::flAffectDynamic)?NORM_DYN_COLOR:NORM_COLOR));
                clr 	= subst_alpha(clr,0x40);
            	const Fvector zero={0.f,0.f,0.f};
                VERIFY(m_FuzzyData);
                switch (m_FuzzyData->m_ShapeType){
                case CLight::SFuzzyData::fstSphere: 
                	DU.DrawSphere	(_Transform(),zero,m_FuzzyData->m_SphereRadius,clr,clr,true,true);
                break;
                case CLight::SFuzzyData::fstBox:
                	DU.DrawAABB		(_Transform(),zero,m_FuzzyData->m_BoxDimension,clr,clr,true,true);
                break;
                }
			}
        break;
        case ELight::ltSpot:		break;
        default: THROW;
        }
	}
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:60,代码来源:ELight.cpp

示例2: Render

void CGlow::Render(int priority, bool strictB2F)
{
    if ((1==priority)&&(true==strictB2F)){
    	if (!m_bDefLoad) OnDeviceCreate();
        ESceneGlowTools* gt = dynamic_cast<ESceneGlowTools*>(ParentTools); VERIFY(gt);
        RCache.set_xform_world(Fidentity);
        if (gt->m_Flags.is(ESceneGlowTools::flTestVisibility)){ 
            Fvector D;	D.sub(Device.vCameraPosition,PPosition);
            float dist 	= D.normalize_magn();
            if (!Scene->RayPickObject(dist,PPosition,D,OBJCLASS_SCENEOBJECT,0,0)){
                if (m_GShader){	Device.SetShader(m_GShader);
                }else{			Device.SetShader(Device.m_WireShader);}
                m_RenderSprite.Render(PPosition,m_fRadius,m_Flags.is(gfFixedSize));
                DU.DrawRomboid(PPosition, VIS_RADIUS, 0x00FF8507);
            }else{
                // рендерим bounding sphere
                Device.SetShader(Device.m_WireShader);
                DU.DrawRomboid(PPosition, VIS_RADIUS, 0x00FF8507);
            }
        }else{
            if (m_GShader){	Device.SetShader(m_GShader);
            }else{			Device.SetShader(Device.m_WireShader);}
            m_RenderSprite.Render(PPosition,m_fRadius,m_Flags.is(gfFixedSize));
        }
        if( Selected() ){
            Fbox bb; GetBox(bb);
            u32 clr = Locked()?0xFFFF0000:0xFFFFFFFF;
            Device.SetShader(Device.m_WireShader);
            DU.DrawSelectionBox(bb,&clr);  
            if (gt->m_Flags.is(ESceneGlowTools::flDrawCross)){
            	Fvector sz; bb.getradius(sz);
        		DU.DrawCross(PPosition,sz.x,sz.y,sz.z, sz.x,sz.y,sz.z,0xFFFFFFFF,false);
            }
        }
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:36,代码来源:glow.cpp


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