private static effectFx_profile_abstractProfile_COMMON MakeProfileCOMMON(ulong id_num) { effectFx_profile_abstractProfile_COMMON proCom = new effectFx_profile_abstractProfile_COMMON(); proCom.technique = new effectFx_profile_abstractProfile_COMMONTechnique(); effectFx_profile_abstractProfile_COMMONTechniqueLambert lambert = new effectFx_profile_abstractProfile_COMMONTechniqueLambert(); common_color_or_texture_type diffuse = new common_color_or_texture_type(); common_color_or_texture_typeTexture tex = new common_color_or_texture_typeTexture(); tex.texture = "sampler2D_" + id_num; diffuse.Item = tex; lambert.diffuse = diffuse; proCom.Items = new object[] { MakeNewParamForEffect(id_num, false), MakeNewParamForEffect(id_num, true) }; proCom.technique.Item = lambert; return(proCom); }
protected void CreateMaterial(Color color, string textureName, string textureCoord, string material, out effect effectColor, out material materialColor) { string effect_ID = string.Format("effect_{0}_ID", material); string effectName = string.Format("effect_{0}", material); common_color_or_texture_type diffuseColorOrTexture = new common_color_or_texture_type(); if (string.IsNullOrEmpty(textureName)) { diffuseColorOrTexture.Item = new common_color_or_texture_typeColor() { Values = new double[] { (double)color.R / 255.0, (double)color.G / 255.0, (double)color.B / 255.0, 1.000000 } } } ; else { diffuseColorOrTexture.Item = new common_color_or_texture_typeTexture() { texture = "sampler_" + textureName, texcoord = textureCoord } }; effectFx_profile_abstractProfile_COMMON effectFx_prof = new effectFx_profile_abstractProfile_COMMON() { technique = new effectFx_profile_abstractProfile_COMMONTechnique() { Item = new effectFx_profile_abstractProfile_COMMONTechniquePhong() { ambient = new common_color_or_texture_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 0.300000, 0.300000, 0.300000, 1.000000 } } }, emission = new common_color_or_texture_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 0.050000, 0.050000, 0.050000, 1.000000 } } }, diffuse = diffuseColorOrTexture, specular = new common_color_or_texture_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 0.500000, 0.500000, 0.500000, 1.000000 } } }, transparent = new common_transparent_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 1.000000, 1.000000, 1.000000, 1.000000 } } }, reflectivity = new common_float_or_param_type() { Item = new common_float_or_param_typeFloat() { Value = 0.000000 } }, shininess = new common_float_or_param_type() { Item = new common_float_or_param_typeFloat() { Value = 25.00000 } }, transparency = new common_float_or_param_type() { Item = new common_float_or_param_typeFloat() { Value = 0.000000 } } } } }; if (!string.IsNullOrEmpty(textureName)) { effectFx_prof.Items = new object[] { new common_newparam_type() { sid = "surf_" + textureName, Item = new fx_surface_common() { type = fx_surface_type_enum.Item2D, init_from = new fx_surface_init_from_common[] { new fx_surface_init_from_common() { Value = textureName + ".jpg" } }, mipmap_generate = false, mipmap_generateSpecified = true }, ItemElementName = ItemChoiceType.surface }, new common_newparam_type() { sid = "sampler_" + textureName, Item = new fx_sampler2D_common() { source = "surf_" + textureName }, ItemElementName = ItemChoiceType.sampler2D } }; } // effect color effectColor = new effect() { id = string.Format("effect_{0}_ID", material), name = string.Format("effect_{0}", material), Items = new effectFx_profile_abstractProfile_COMMON[] { effectFx_prof } }; // materials materialColor = new material() { id = string.Format("material_{0}_ID", material), name = string.Format("material_{0}", material), instance_effect = new instance_effect() { url = string.Format("#{0}", effectColor.id) } }; }