Intermediate class to convert various Rhino shader types to Cycles shaders @todo better organise shader intermediary code instead of overloading heavily
Beispiel #1
0
        internal CclShader RecreateMaterialShader(CyclesShader shader, CclShader existing)
        {
            CclShader sh = null;

            if (shader.DisplayMaterial && shader.ValidDisplayMaterial)
            {
                sh = RecreateCyclesShaderFromRhinoV6BasicMat(shader, existing);
            }
            else
            {
                switch (shader.Front.CyclesMaterialType)
                {
                case ShaderBody.CyclesMaterial.Xml:
                case ShaderBody.CyclesMaterial.FlakedCarPaint:
                    sh = RecreateCyclesShaderFromXml(shader.Front, existing);
                    break;

                default:
                    sh = RecreateCyclesShaderFromRhinoV6BasicMat(shader, existing);
                    break;
                }
            }

            return(sh);
        }
        internal CclShader CreateCyclesShaderFromXml(CyclesShader shader)
        {
            var sh = new CclShader(Client, CclShader.ShaderType.Material)
            {
                UseMis = true,
                UseTransparentShadow = true,
                HeterogeneousVolume = false,
                Name = shader.Name ?? $"V6 Basic Material {shader.Id}"
            };

            CclShader.ShaderFromXml(ref sh, shader.Crm.MaterialXml);

            return sh;
        }
Beispiel #3
0
        internal CclShader RecreateCyclesShaderFromRhinoV6BasicMat(CyclesShader shader, CclShader existing)
        {
            var v6 = RhinoShader.RecreateRhinoMaterialShader(Client, shader, existing);

            return(v6.GetShader());
        }
Beispiel #4
0
        internal CclShader CreateCyclesShaderFromRhinoV6BasicMat(CyclesShader shader)
        {
            var v6 = RhinoShader.CreateRhinoMaterialShader(Client, shader);

            return(v6.GetShader());
        }
        internal CclShader CreateMaterialShader(CyclesShader shader)
        {
            CclShader sh = null;
            switch (shader.CyclesMaterialType)
            {
                case CyclesShader.CyclesMaterial.Xml:
                    sh = CreateCyclesShaderFromXml(shader);
                    break;
                default:
                    sh = CreateCyclesShaderFromRhinoV6BasicMat(shader);
                    break;
            }

            return sh;
        }
        internal CclShader CreateCyclesShaderFromRhinoV6BasicMat(CyclesShader shader)
        {
            var v6 = RhinoShader.CreateRhinoMaterialShader(Client, shader);

            return v6.GetShader();
        }
        internal CclShader RecreateCyclesShaderFromXml(CyclesShader shader, CclShader existing)
        {
            existing.Recreate();
            CclShader.ShaderFromXml(ref existing, shader.Crm.MaterialXml);

            return existing;
        }
        internal CclShader RecreateCyclesShaderFromRhinoV6BasicMat(CyclesShader shader, CclShader existing)
        {
            var v6 = RhinoShader.RecreateRhinoMaterialShader(Client, shader, existing);

            return v6.GetShader();
        }