Example #1
0
	void COgreManager::ApplyShadowParams()
	{
		EnableShadow(m_effectCfg.bShadow);
		m_pSceneMgr->setShadowFarDistance(Ogre::StringConverter::parseReal(m_shadowParams["FarDistance"]));
		m_pSceneMgr->setShadowTextureCountPerLightType(Ogre::Light::LT_DIRECTIONAL, 3);
		m_pSceneMgr->setShadowDirectionalLightExtrusionDistance(Ogre::StringConverter::parseReal(m_shadowParams["LightExtrusionDistance"]));
		m_pSceneMgr->setShadowTextureCount(3);
		FLOAT3 texSize = Ogre::StringConverter::parseVector3(m_shadowParams["ShadowMapSize"]);
		m_pSceneMgr->setShadowTextureConfig(0, texSize.x, texSize.x, PF_FLOAT32_R);
		m_pSceneMgr->setShadowTextureConfig(1, texSize.y, texSize.y, PF_FLOAT32_R);
		m_pSceneMgr->setShadowTextureConfig(2, texSize.z, texSize.z, PF_FLOAT32_R);
		m_pSceneMgr->setShadowTextureSelfShadow(Ogre::StringConverter::parseBool(m_shadowParams["SelfShadow"]));
		m_pSceneMgr->setShadowCasterRenderBackFaces(Ogre::StringConverter::parseBool(m_shadowParams["RenderBackFace"]));
		m_pSceneMgr->setShadowTextureCasterMaterial("Ogre/shadow/depth/caster");

		PSSMShadowCameraSetup* cam = GetShadowCameraSetup();

		cam->setSplitPadding(Ogre::StringConverter::parseBool(m_shadowParams["SplitPadding"]));
		cam->calculateSplitPoints(3, m_pMainCamera->getNearClipDistance(), m_pSceneMgr->getShadowFarDistance(), 
			Ogre::StringConverter::parseReal(m_shadowParams["PssmLambda"]));
		FLOAT3 adjust = Ogre::StringConverter::parseVector3(m_shadowParams["AdjustFactor"]);
		cam->setOptimalAdjustFactor(0, adjust.x);
		cam->setOptimalAdjustFactor(1, adjust.y);
		cam->setOptimalAdjustFactor(2, adjust.z);
		cam->setUseSimpleOptimalAdjust(Ogre::StringConverter::parseBool(m_shadowParams["UseSimpleAdjust"]));
		cam->setCameraLightDirectionThreshold(Degree(Ogre::StringConverter::parseReal(m_shadowParams["CameraLightDirectionThreshold"])));
	}
Example #2
0
EXPORT_C void CHuiTexture::Reset()
    {
    EnableShadow(EFalse); // deletes the shadow textures
    RemoveAllSegments();
    iActiveSegment = 0;
    iSize = TSize(0, 0);
    iPlaceholder = NULL;
    // We're not resetting the texture name here.
    // this is intentional since the name may be
    // used to restore the texture content later on
    }
Example #3
0
	void COgreManager::ResetEffect()
	{
		CompositorManager& mgr = CompositorManager::getSingleton();
		mgr.removeCompositor(m_pViewport, "DeferredShading/SSAO");
		mgr.removeCompositor(m_pViewport, "Sharpen");
		mgr.removeCompositor(m_pViewport, "FXAA");

		m_ssao = CompositorManager::getSingleton().addCompositor(m_pViewport, "DeferredShading/SSAO");
		m_sharpen = CompositorManager::getSingleton().addCompositor(m_pViewport, "Sharpen");
		m_fxaa = CompositorManager::getSingleton().addCompositor(m_pViewport, "FXAA");
		assert(m_fxaa);
		assert(m_ssao);
		assert(m_sharpen);

		EnableShadow(m_effectCfg.bShadow);
		EnableSSAO(m_effectCfg.bSSAO);
		EnableSharpen(m_effectCfg.bSharpen);
		EnableFXAA(m_effectCfg.bFXAA);
	}
Example #4
0
BOOL CEngineObject::Init(char* filename,CObjectBase* pObject,BYTE EngineObjectType)
{
	if(m_GXOHandle == NULL)
		m_CurMotionNum = 1;

	Release();
	
	//m_CurMotionNum = -1;
	//m_bAnimationRoop = TRUE;
	m_bMotionPause = FALSE;	
	m_bEndMotion = FALSE;

	m_pObject = pObject;
	if(m_pObject)
		m_pObject->m_EngineObjectType = EngineObjectType;
	
	DWORD dwFlag = 0;
	if( EngineObjectType == eEngineObjectType_Effect ||
		EngineObjectType == eEngineObjectType_Weapon)
		dwFlag = GXOBJECT_CREATE_TYPE_EFFECT;

	if(EngineObjectType == eEngineObjectType_Character)
		DIRECTORYMGR->SetLoadMode(eLM_Character);
	else if(EngineObjectType == eEngineObjectType_Monster)
		DIRECTORYMGR->SetLoadMode(eLM_Monster);
	else if(EngineObjectType == eEngineObjectType_Npc)
		DIRECTORYMGR->SetLoadMode(eLM_Npc);
	else if(EngineObjectType == eEngineObjectType_Effect)
		DIRECTORYMGR->SetLoadMode(eLM_Effect);
	else if(EngineObjectType == eEngineObjectType_Weapon)
		DIRECTORYMGR->SetLoadMode(eLM_Character);
	
	//////////////////////////////////////////////////////////////////////////
	// 임시 설정
	PreLoadObject(filename);
	//////////////////////////////////////////////////////////////////////////
	
	m_GXOHandle = g_pExecutive->CreateGXObject(filename,MHPlayerPROC,this,dwFlag);
	if(m_GXOHandle == NULL)
	{
		char temp[256];
		sprintf(temp,"오브젝트 생성 실패 : %s",filename);
		MessageBox(NULL,temp,NULL,NULL);
		return FALSE;
	}
	
	if(EngineObjectType == eEngineObjectType_Effect)
		EnableShadow(FALSE);
	
	//yh2do test
	//g_pExecutive->EnableUpdateShading(m_GXOHandle);
	
	LoadInfoFile(filename);


	DIRECTORYMGR->SetLoadMode(eLM_Root);
	
	//FILE* fp = fopen("
	SetEngineToCurmotion();
	
	return TRUE;
}
Example #5
0
void FCanvasTextItem::Draw( class FCanvas* InCanvas )
{	
	SCOPE_CYCLE_COUNTER(STAT_Canvas_TextItemTime);

	if(Font == NULL || Text.IsEmpty() )
	{
		return;
	}

	XScale = Scale.X;
	YScale = Scale.Y;

	bool bHasShadow = ShadowOffset.Size() != 0.0f;
	if( ( FontRenderInfo.bEnableShadow == true ) && ( bHasShadow == false ) )
	{
		EnableShadow( FLinearColor::Black );
		bHasShadow = true;
	}
	if (Font->ImportOptions.bUseDistanceFieldAlpha)
	{
		// convert blend mode to distance field type
		switch(BlendMode)
		{
		case SE_BLEND_Translucent:
			BlendMode = (FontRenderInfo.bEnableShadow) ? SE_BLEND_TranslucentDistanceFieldShadowed : SE_BLEND_TranslucentDistanceField;
			break;
		case SE_BLEND_Masked:
			BlendMode = (FontRenderInfo.bEnableShadow) ? SE_BLEND_MaskedDistanceFieldShadowed : SE_BLEND_MaskedDistanceField;
			break;
		}
		// Disable the show if the blend mode is not suitable
		if (BlendMode != SE_BLEND_TranslucentDistanceFieldShadowed && BlendMode != SE_BLEND_MaskedDistanceFieldShadowed)
		{
			bHasShadow = false;
		}
	}	

	CharIncrement = ( (float)Font->Kerning + HorizSpacingAdjust ) * Scale.X;
	DrawnSize.Y = Font->GetMaxCharHeight() * Scale.Y;

	FVector2D DrawPos( Position.X , Position.Y );

	// If we are centering the string or we want to fix stereoscopic rending issues we need to measure the string
	if( ( bCentreX || bCentreY ) || ( !bDontCorrectStereoscopic ) )
	{
		FTextSizingParameters Parameters( Font, Scale.X ,Scale.Y );
		UCanvas::CanvasStringSize( Parameters, *Text.ToString() );
				
		// Calculate the offset if we are centering
		if( bCentreX || bCentreY )
		{		
			// Note we drop the fraction after the length divide or we can end up with coords on 1/2 pixel boundaries
			if( bCentreX )
			{
				DrawPos.X = DrawPos.X - (int)( Parameters.DrawXL / 2 );
			}
			if( bCentreY )
			{
				DrawPos.Y = DrawPos.Y - (int)( Parameters.DrawYL / 2 );
			}
		}

		// Check if we want to correct the stereo3d issues - if we do, render the correction now
		bool CorrectStereo = !bDontCorrectStereoscopic  && GEngine->IsStereoscopic3D();
		if( CorrectStereo )
		{
			FVector2D StereoOutlineBoxSize( 2.0f, 2.0f );
			TileItem.MaterialRenderProxy = GEngine->RemoveSurfaceMaterial->GetRenderProxy( false );
			TileItem.Position = DrawPos - StereoOutlineBoxSize;
			FVector2D CorrectionSize = FVector2D( Parameters.DrawXL, Parameters.DrawYL ) + StereoOutlineBoxSize + StereoOutlineBoxSize;
			TileItem.Size=  CorrectionSize;
			TileItem.bFreezeTime = true;
			TileItem.Draw( InCanvas );
		}		
	}
	
	FLinearColor DrawColor;
	BatchedElements = NULL;
	TextLen = Text.ToString().Len();
	if( bOutlined )
	{
		DrawColor = OutlineColor;
		DrawColor.A *= InCanvas->AlphaModulate;
		DrawStringInternal( InCanvas, DrawPos + FVector2D( -1.0f, -1.0f ), DrawColor );
		DrawStringInternal( InCanvas, DrawPos + FVector2D( -1.0f, 1.0f ), DrawColor );
		DrawStringInternal( InCanvas, DrawPos + FVector2D( 1.0f, 1.0f ), DrawColor );
		DrawStringInternal( InCanvas, DrawPos + FVector2D( 1.0f, -1.0f ), DrawColor );
	}
	// If we have a shadow - draw it now
	if( bHasShadow )
	{
		DrawColor = ShadowColor;
		// Copy the Alpha from the shadow otherwise if we fade the text the shadow wont fade - which is almost certainly not what we will want.
		DrawColor.A = Color.A;
		DrawColor.A *= InCanvas->AlphaModulate;
		DrawStringInternal( InCanvas, DrawPos + ShadowOffset, DrawColor );
	}
	DrawColor = Color;
	DrawColor.A *= InCanvas->AlphaModulate;	
	DrawStringInternal( InCanvas, DrawPos, DrawColor );
	
	return;
}