Ejemplo n.º 1
0
        public Material restoreState(RestorableSupport rs, RestorableSupport.StateObject so)
        {
            double shininess = this.getShininess();
            Double d         = rs.getStateValueAsDouble(so, "shininess");

            if (d != null)
            {
                shininess = d;
            }

            String as = rs.getStateValueAsString(so, "ambient");
            Color ambient = RestorableSupport.decodeColor(as);

            if (ambient == null)
            {
                ambient = this.getAmbient();
            }

            String ds      = rs.getStateValueAsString(so, "diffuse");
            Color  diffuse = RestorableSupport.decodeColor(ds);

            if (diffuse == null)
            {
                diffuse = this.getDiffuse();
            }

            String ss       = rs.getStateValueAsString(so, "specular");
            Color  specular = RestorableSupport.decodeColor(ss);

            if (specular == null)
            {
                specular = this.getSpecular();
            }

            String es       = rs.getStateValueAsString(so, "emission");
            Color  emission = RestorableSupport.decodeColor(es);

            if (emission == null)
            {
                emission = this.getEmission();
            }

            return(new Material(specular, diffuse, ambient, emission, (float)shininess));
        }