private RasterizerState LoadRasterizerState(IAetherReader reader) { RasterizerState rasterizerState = new RasterizerState(); string str; Int64 i64; float flt; bool bl; reader.ReadString("Name", out str); rasterizerState.Name = str; reader.ReadInt64("CullMode", out i64); rasterizerState.CullMode = (CullMode)i64; reader.ReadFloat("DepthBias", out flt); rasterizerState.DepthBias = flt; reader.ReadInt64("FillMode", out i64); rasterizerState.FillMode = (FillMode)i64; reader.ReadBoolean("MultiSampleAntiAlias", out bl); rasterizerState.MultiSampleAntiAlias = bl; reader.ReadBoolean("ScissorTestEnable", out bl); rasterizerState.ScissorTestEnable = bl; reader.ReadFloat("SlopeScaleDepthBias", out flt); rasterizerState.SlopeScaleDepthBias = flt; return(rasterizerState); }
public virtual void Load(IAetherReader reader) { string str; Int64 i64; reader.ReadInt64("PrimitiveType", out i64); PrimitiveType = (PrimitiveType)i64; this.BlendState = LoadBlendState(reader); this.DepthStencilState = LoadDepthStencilState(reader); this.RasterizerState = LoadRasterizerState(reader); LoadSamplerStates(reader, this.SamplerStates); }
public override void Load(IAetherReader reader) { base.Load(reader); Vector3 vctr3; float flt; Int64 i64; bool bl; reader.ReadVector3("DiffuseColor", out vctr3); DiffuseColor = vctr3; reader.ReadFloat("Alpha", out flt); Alpha = flt; reader.ReadInt64("ReferenceAlpha", out i64); ReferenceAlpha = (int)i64; reader.ReadBoolean("VertexColorEnabled", out bl); VertexColorEnabled = bl; }
public override void Load(IAetherReader reader) { base.Load(reader); Vector3 vctr3; float flt; Int64 i64; reader.ReadVector3("DiffuseColor", out vctr3); DiffuseColor = vctr3; reader.ReadVector3("AmbientLightColor", out vctr3); AmbientLightColor = vctr3; reader.ReadVector3("EmissiveColor", out vctr3); EmissiveColor = vctr3; DirectionalLight0 = ReadDirectionalLight(reader, "DirectionalLight0"); DirectionalLight1 = ReadDirectionalLight(reader, "DirectionalLight1"); DirectionalLight2 = ReadDirectionalLight(reader, "DirectionalLight2"); reader.ReadFloat("Alpha", out flt); Alpha = flt; reader.ReadInt64("LightingEnabled", out i64); WeightsPerVertex = (int)i64; }
private void LoadSamplerStates(IAetherReader reader, SamplerState[] samplerStates) { int samplerStateCount; reader.ReadInt32("SamplerStateCount", out samplerStateCount); for (int i = 0; i < samplerStateCount; i++) { SamplerState samplerState = new SamplerState(); string str; Int64 i64; float flt; reader.ReadString("Name", out str); samplerState.Name = str; reader.ReadInt64("AddressU", out i64); samplerState.AddressU = (TextureAddressMode)i64; reader.ReadInt64("AddressV", out i64); samplerState.AddressV = (TextureAddressMode)i64; reader.ReadInt64("AddressW", out i64); samplerState.AddressW = (TextureAddressMode)i64; reader.ReadInt64("Filter", out i64); samplerState.Filter = (TextureFilter)i64; reader.ReadInt64("MaxAnisotropy", out i64); samplerState.MaxAnisotropy = (int)i64; reader.ReadInt64("MaxMipLevel", out i64); samplerState.MaxMipLevel = (int)i64; reader.ReadFloat("MipMapLevelOfDetailBias", out flt); samplerState.MipMapLevelOfDetailBias = flt; samplerStates[i] = samplerState; } }
private DepthStencilState LoadDepthStencilState(IAetherReader reader) { DepthStencilState depthStencilState = new DepthStencilState(); string str; Int64 i64; bool bl; reader.ReadString("Name", out str); depthStencilState.Name = str; reader.ReadInt64("CounterClockwiseStencilDepthBufferFail", out i64); depthStencilState.CounterClockwiseStencilDepthBufferFail = (StencilOperation)i64; reader.ReadInt64("CounterClockwiseStencilFail", out i64); depthStencilState.CounterClockwiseStencilFail = (StencilOperation)i64; reader.ReadInt64("CounterClockwiseStencilFunction", out i64); depthStencilState.CounterClockwiseStencilFunction = (CompareFunction)i64; reader.ReadInt64("CounterClockwiseStencilPass", out i64); depthStencilState.CounterClockwiseStencilPass = (StencilOperation)i64; reader.ReadBoolean("DepthBufferEnable", out bl); depthStencilState.DepthBufferEnable = bl; reader.ReadInt64("DepthBufferFunction", out i64); depthStencilState.DepthBufferFunction = (CompareFunction)i64; reader.ReadBoolean("DepthBufferWriteEnable", out bl); depthStencilState.DepthBufferWriteEnable = bl; reader.ReadInt64("ReferenceStencil", out i64); depthStencilState.ReferenceStencil = (int)i64; reader.ReadInt64("StencilDepthBufferFail", out i64); depthStencilState.StencilDepthBufferFail = (StencilOperation)i64; reader.ReadBoolean("StencilEnable", out bl); depthStencilState.StencilEnable = bl; reader.ReadInt64("StencilFail", out i64); depthStencilState.StencilFail = (StencilOperation)i64; reader.ReadInt64("StencilFunction", out i64); depthStencilState.StencilFunction = (CompareFunction)i64; reader.ReadInt64("StencilMask", out i64); depthStencilState.StencilMask = (int)i64; reader.ReadInt64("StencilPass", out i64); depthStencilState.StencilPass = (StencilOperation)i64; reader.ReadInt64("StencilWriteMask", out i64); depthStencilState.StencilWriteMask = (int)i64; reader.ReadBoolean("TwoSidedStencilMode", out bl); depthStencilState.TwoSidedStencilMode = bl; return(depthStencilState); }
private BlendState LoadBlendState(IAetherReader reader) { BlendState blendState = new BlendState(); string str; Int64 i64; Color col; reader.ReadString("Name", out str); blendState.Name = str; reader.ReadString("BlendStateName", out str); blendState.Name = str; reader.ReadInt64("AlphaBlendFunction", out i64); blendState.AlphaBlendFunction = (BlendFunction)i64; reader.ReadInt64("AlphaDestinationBlend", out i64); blendState.AlphaDestinationBlend = (Blend)i64; reader.ReadInt64("AlphaSourceBlend", out i64); blendState.AlphaSourceBlend = (Blend)i64; reader.ReadColor("BlendFactor", out col); blendState.BlendFactor = col; reader.ReadInt64("ColorBlendFunction", out i64); blendState.ColorBlendFunction = (BlendFunction)i64; reader.ReadInt64("ColorDestinationBlend", out i64); blendState.ColorDestinationBlend = (Blend)i64; reader.ReadInt64("ColorSourceBlend", out i64); blendState.ColorSourceBlend = (Blend)i64; reader.ReadInt64("ColorWriteChannels", out i64); blendState.ColorWriteChannels = (ColorWriteChannels)i64; reader.ReadInt64("ColorWriteChannels1", out i64); blendState.ColorWriteChannels1 = (ColorWriteChannels)i64; reader.ReadInt64("ColorWriteChannels2", out i64); blendState.ColorWriteChannels2 = (ColorWriteChannels)i64; reader.ReadInt64("ColorWriteChannels3", out i64); blendState.ColorWriteChannels3 = (ColorWriteChannels)i64; reader.ReadInt64("MultiSampleMask", out i64); blendState.MultiSampleMask = (int)i64; return(blendState); }