static public void UpdateForwardLights() { const float RADIUS_FOR_LIGHTS = 400; BoundingSphere sphere = new BoundingSphere(MyCamera.Position, RADIUS_FOR_LIGHTS); GetRenderProfiler().StartProfilingBlock("Setup lights"); MyEffectModelsDNS effectDNS = (MyEffectModelsDNS)GetEffect(MyEffects.ModelDNS); MyLights.UpdateEffect(effectDNS.DynamicLights, ref sphere, true); MyLights.UpdateEffectReflector(effectDNS.Reflector, true); MyEffectVoxels effectVoxels = (MyEffectVoxels)GetEffect(MyEffects.VoxelsMRT); MyLights.UpdateEffect(effectVoxels.DynamicLights, ref sphere, true); MyLights.UpdateEffectReflector(effectVoxels.Reflector, true); MyEffectDecals effectDecals = (MyEffectDecals)GetEffect(MyEffects.Decals); MyLights.UpdateEffect(effectDecals.DynamicLights, ref sphere, true); MyLights.UpdateEffectReflector(effectDecals.Reflector, true); GetRenderProfiler().EndProfilingBlock(); //Setup lights }
public override MyEffectBase PrepareAndBeginShader(MyRender.MyRenderSetup setup, MyLodTypeEnum lodType) { var shader = (MyEffectModelsDNS)MyRender.GetEffect(MyEffects.ModelDNS); SetupBaseEffect(shader, setup, lodType); MyEffectModelsDNS dnsShader = shader as MyEffectModelsDNS; dnsShader.SetHalfPixel(MyRenderCamera.Viewport.Width, MyRenderCamera.Viewport.Height); dnsShader.SetScale(MyRender.GetScaleForViewport(MyRender.GetRenderTarget(MyRenderTargets.Depth))); bool useDepth = lodType != MyLodTypeEnum.LOD_NEAR; if (useDepth) { // DepthStencilState.DepthRead; MyStateObjects.DepthStencil_TestFarObject_DepthReadOnly.Apply(); } else { DepthStencilState.DepthRead.Apply(); } MyStateObjects.Holo_BlendState.Apply(); shader.ApplyHolo(!useDepth); shader.Begin(0, SharpDX.Direct3D9.FX.None); return(shader); }
public sealed override void SetupEntity(MyEffectBase shader, MyRender.MyRenderElement renderElement) { base.SetupEntity(shader, renderElement); MyEffectModelsDNS effectDNS = shader as MyEffectModelsDNS; MyRenderCharacter character = renderElement.RenderObject as MyRenderCharacter; var bonesUsed = renderElement.BonesUsed; if (character.SkinMatrices != null) { if (bonesUsed == null) { for (int i = 0; i < Math.Min(character.SkinMatrices.Length, MyRenderConstants.MAX_SHADER_BONES); i++) { m_bonesBuffer[i] = character.SkinMatrices[i]; } } else { for (int i = 0; i < bonesUsed.Length; i++) { m_bonesBuffer[i] = character.SkinMatrices[bonesUsed[i]]; } } effectDNS.SetBones(m_bonesBuffer); } }
public override void SetupEntity(MyEffectBase shader, MyRender.MyRenderElement renderElement) { MyEffectModelsDNS effectDNS = shader as MyEffectModelsDNS; effectDNS.SetWorldMatrix((Matrix)renderElement.WorldMatrixForDraw); effectDNS.SetDiffuseColor(renderElement.Color); effectDNS.Dithering = renderElement.Dithering; effectDNS.Time = (float)MyRender.InterpolationTime.Miliseconds; effectDNS.SetColorMaskHSV(renderElement.ColorMaskHSV); }
public override void SetupEntity(MyEffectBase shader, MyRender.MyRenderElement renderElement) { MyEffectModelsDNS effectDNS = shader as MyEffectModelsDNS; // This is required, it's position of whole group effectDNS.SetWorldMatrix((Matrix)renderElement.WorldMatrixForDraw); // This should be in instance buffer when required effectDNS.SetDiffuseColor(renderElement.Color); effectDNS.Dithering = renderElement.Dithering; effectDNS.SetColorMaskHSV(renderElement.ColorMaskHSV); effectDNS.SetEmissivity(0); }
static public void UpdateForwardLights() { GetRenderProfiler().StartProfilingBlock("Setup lights"); MyEffectModelsDNS effectDNS = (MyEffectModelsDNS)GetEffect(MyEffects.ModelDNS); MyLights.UpdateEffect(effectDNS.DynamicLights, true); MyLights.UpdateEffectReflector(effectDNS.Reflector, true); MyEffectVoxels effectVoxels = (MyEffectVoxels)GetEffect(MyEffects.VoxelsMRT); MyLights.UpdateEffect(effectVoxels.DynamicLights, true); MyLights.UpdateEffectReflector(effectVoxels.Reflector, true); MyEffectDecals effectDecals = (MyEffectDecals)GetEffect(MyEffects.Decals); MyLights.UpdateEffect(effectDecals.DynamicLights, true); MyLights.UpdateEffectReflector(effectDecals.Reflector, true); GetRenderProfiler().EndProfilingBlock(); //Setup lights }