private DAEVector4 GetRgbaColor(object commonColor) { if (commonColor is common_color_or_texture_typeColor) { common_color_or_texture_typeColor color = commonColor as common_color_or_texture_typeColor; DAEVector4 result = new DAEVector4(); result.X = color.Values[0]; result.Y = color.Values[1]; result.Z = color.Values[2]; result.W = color.Values[3]; return(result); } return(new DAEVector4(1, 1, 1, 1)); }
private static void SetPhong(effectFx_profile_abstractProfile_COMMONTechniquePhong phong, Vector4 diffuse) { phong.diffuse = new common_color_or_texture_type(); var col = new common_color_or_texture_typeColor(); col.sid = "diffuse"; phong.diffuse.Item = col; col.Values = new double[] { diffuse.x, diffuse.y, diffuse.z, diffuse.w }; phong.emission = new common_color_or_texture_type(); var emissionColor = new common_color_or_texture_typeColor(); emissionColor.sid = "emission"; emissionColor.Values = new double[] { 0, 0, 0, 1 }; phong.emission.Item = emissionColor; phong.ambient = new common_color_or_texture_type(); var ambientColor = new common_color_or_texture_typeColor(); ambientColor.sid = "ambient"; ambientColor.Values = new double[] { 0, 0, 0, 1 }; phong.ambient.Item = ambientColor; phong.specular = new common_color_or_texture_type(); var specularColor = new common_color_or_texture_typeColor(); specularColor.sid = "specular"; specularColor.Values = new double[] { 0.5, 0.5, 0.5, 1 }; phong.specular.Item = specularColor; phong.shininess = new common_float_or_param_type(); var f = new common_float_or_param_typeFloat(); f.Value = 50; phong.shininess.Item = f; phong.index_of_refraction = new common_float_or_param_type(); var f2 = new common_float_or_param_typeFloat(); f2.Value = 1; phong.index_of_refraction.Item = f2; }