Beispiel #1
0
        private static string ConvertSerializedStencilOp(SerializedStencilOp stencilOp, string suffix)
        {
            var sb = new StringBuilder();

            sb.Append($"   Comp{suffix} {ConvertStencilComp(stencilOp.comp)}\n");
            sb.Append($"   Pass{suffix} {ConvertStencilOp(stencilOp.pass)}\n");
            sb.Append($"   Fail{suffix} {ConvertStencilOp(stencilOp.fail)}\n");
            sb.Append($"   ZFail{suffix} {ConvertStencilOp(stencilOp.zFail)}\n");
            return(sb.ToString());
        }
Beispiel #2
0
        public SerializedShaderState(ObjectReader reader)
        {
            var version = reader.version;

            m_Name  = reader.ReadAlignedString();
            rtBlend = new SerializedShaderRTBlendState[8];
            for (var i = 0; i < 8; i++)
            {
                rtBlend[i] = new SerializedShaderRTBlendState(reader);
            }
            rtSeparateBlend = reader.ReadBoolean();
            reader.AlignStream();
            if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
            {
                zClip = new SerializedShaderFloatValue(reader);
            }
            zTest   = new SerializedShaderFloatValue(reader);
            zWrite  = new SerializedShaderFloatValue(reader);
            culling = new SerializedShaderFloatValue(reader);
            if (version[0] >= 2020) //2020.1 and up
            {
                conservative = new SerializedShaderFloatValue(reader);
            }
            offsetFactor     = new SerializedShaderFloatValue(reader);
            offsetUnits      = new SerializedShaderFloatValue(reader);
            alphaToMask      = new SerializedShaderFloatValue(reader);
            stencilOp        = new SerializedStencilOp(reader);
            stencilOpFront   = new SerializedStencilOp(reader);
            stencilOpBack    = new SerializedStencilOp(reader);
            stencilReadMask  = new SerializedShaderFloatValue(reader);
            stencilWriteMask = new SerializedShaderFloatValue(reader);
            stencilRef       = new SerializedShaderFloatValue(reader);
            fogStart         = new SerializedShaderFloatValue(reader);
            fogEnd           = new SerializedShaderFloatValue(reader);
            fogDensity       = new SerializedShaderFloatValue(reader);
            fogColor         = new SerializedShaderVectorValue(reader);
            fogMode          = (FogMode)reader.ReadInt32();
            gpuProgramID     = reader.ReadInt32();
            m_Tags           = new SerializedTagMap(reader);
            m_LOD            = reader.ReadInt32();
            lighting         = reader.ReadBoolean();
            reader.AlignStream();
        }