private void SaveSamplerStates(IAetherWriter writer, SamplerState[] samplerStates) { int samplerStateCount = samplerStates.Length; for (int i = 0; i < samplerStateCount; i++) { if (samplerStates[i] == null) { samplerStateCount = i; break; } } writer.WriteInt32("SamplerStateCount", samplerStateCount); for (int i = 0; i < samplerStateCount; i++) { SamplerState samplerState = samplerStates[i]; writer.WriteString("Name", samplerState.Name); writer.WriteInt64("AddressU", (int)samplerState.AddressU); writer.WriteInt64("AddressV", (int)samplerState.AddressV); writer.WriteInt64("AddressW", (int)samplerState.AddressW); writer.WriteInt64("Filter", (int)samplerState.Filter); writer.WriteInt64("MaxAnisotropy", samplerState.MaxAnisotropy); writer.WriteInt64("MaxMipLevel", samplerState.MaxMipLevel); writer.WriteFloat("MipMapLevelOfDetailBias", samplerState.MipMapLevelOfDetailBias); } }
private void SaveBlendState(IAetherWriter writer, BlendState blendState) { writer.WriteString("Name", blendState.Name); writer.WriteString("BlendStateName", blendState.Name); writer.WriteInt64("AlphaBlendFunction", (int)blendState.AlphaBlendFunction); writer.WriteInt64("AlphaDestinationBlend", (int)blendState.AlphaDestinationBlend); writer.WriteInt64("AlphaSourceBlend", (int)blendState.AlphaSourceBlend); writer.WriteColor("BlendFactor", blendState.BlendFactor); writer.WriteInt64("ColorBlendFunction", (int)blendState.ColorBlendFunction); writer.WriteInt64("ColorDestinationBlend", (int)blendState.ColorDestinationBlend); writer.WriteInt64("ColorSourceBlend", (int)blendState.ColorSourceBlend); writer.WriteInt64("ColorWriteChannels", (int)blendState.ColorWriteChannels); writer.WriteInt64("ColorWriteChannels1", (int)blendState.ColorWriteChannels1); writer.WriteInt64("ColorWriteChannels2", (int)blendState.ColorWriteChannels2); writer.WriteInt64("ColorWriteChannels3", (int)blendState.ColorWriteChannels3); writer.WriteInt64("MultiSampleMask", (int)blendState.MultiSampleMask); }
private void SaveRasterizerState(IAetherWriter writer, RasterizerState rasterizerState) { writer.WriteString("Name", rasterizerState.Name); writer.WriteInt64("CullMode", (int)rasterizerState.CullMode); writer.WriteFloat("DepthBias", rasterizerState.DepthBias); writer.WriteInt64("FillMode", (int)rasterizerState.FillMode); writer.WriteBoolean("MultiSampleAntiAlias", rasterizerState.MultiSampleAntiAlias); writer.WriteBoolean("ScissorTestEnable", rasterizerState.ScissorTestEnable); writer.WriteFloat("SlopeScaleDepthBias", rasterizerState.SlopeScaleDepthBias); }
private void SaveDepthStencilState(IAetherWriter writer, DepthStencilState depthStencilState) { writer.WriteString("Name", depthStencilState.Name); writer.WriteInt64("CounterClockwiseStencilDepthBufferFail", (int)depthStencilState.CounterClockwiseStencilDepthBufferFail); writer.WriteInt64("CounterClockwiseStencilFail", (int)depthStencilState.CounterClockwiseStencilFail); writer.WriteInt64("CounterClockwiseStencilFunction", (int)depthStencilState.CounterClockwiseStencilFunction); writer.WriteInt64("CounterClockwiseStencilPass", (int)depthStencilState.CounterClockwiseStencilPass); writer.WriteBoolean("DepthBufferEnable", depthStencilState.DepthBufferEnable); writer.WriteInt64("DepthBufferFunction", (int)depthStencilState.DepthBufferFunction); writer.WriteBoolean("DepthBufferWriteEnable", depthStencilState.DepthBufferWriteEnable); writer.WriteInt64("ReferenceStencil", depthStencilState.ReferenceStencil); writer.WriteInt64("StencilDepthBufferFail", (int)depthStencilState.StencilDepthBufferFail); writer.WriteBoolean("StencilEnable", depthStencilState.StencilEnable); writer.WriteInt64("StencilFail", (int)depthStencilState.StencilFail); writer.WriteInt64("StencilFunction", (int)depthStencilState.StencilFunction); writer.WriteInt64("StencilMask", depthStencilState.StencilMask); writer.WriteInt64("StencilPass", (int)depthStencilState.StencilPass); writer.WriteInt64("StencilWriteMask", depthStencilState.StencilWriteMask); writer.WriteBoolean("TwoSidedStencilMode", depthStencilState.TwoSidedStencilMode); }