private DAEVector4 GetColor(fx_opaque_enum opaqueMode, DAEVector4 color, DAEVector4 transparentColor, double transparency) { switch (opaqueMode) { case fx_opaque_enum.A_ONE: return(GetAOneColor(color, transparentColor, transparency)); default: return(GetRgbZeroColor(color, transparentColor, transparency)); } }
public CommonTransparentType() { this.opaqueField = fx_opaque_enum.A_ONE; }
public common_transparent_type() { opaqueField = fx_opaque_enum.A_ONE; }
internal DAEEffect(effect efx) { foreach (effectFx_profile_abstractProfile_COMMON profile in efx.Items) { if (profile.Items != null) { foreach (var item in profile.Items) { if (item is common_newparam_type) { common_newparam_type newparam = item as common_newparam_type; if (newparam.Item is fx_surface_common) { foreach (fx_surface_init_from_common initFrom in (newparam.Item as fx_surface_common).init_from) { _imageId = initFrom.Value; break; } } } } } effectFx_profile_abstractProfile_COMMONTechnique technique = profile.technique; DAEVector4 transpColor = new DAEVector4(1, 1, 1, 1); double transparency = 1; fx_opaque_enum opaqueMode = fx_opaque_enum.RGB_ZERO; if (technique.Item is effectFx_profile_abstractProfile_COMMONTechniquePhong) // phong { effectFx_profile_abstractProfile_COMMONTechniquePhong p = technique.Item as effectFx_profile_abstractProfile_COMMONTechniquePhong; if (p.transparent != null) { if (p.transparency != null) { if (p.transparency.Item is common_float_or_param_typeFloat) { opaqueMode = p.transparent.opaque; transpColor = GetRgbaColor(p.transparent.Item); transparency = (p.transparency.Item as common_float_or_param_typeFloat).Value; } } } if (p.ambient != null) { _ambient = GetColor(opaqueMode, GetRgbaColor(p.ambient.Item), transpColor, transparency); } if (p.diffuse != null) { _diffuse = GetColor(opaqueMode, GetRgbaColor(p.diffuse.Item), transpColor, transparency); } if (p.specular != null) { _specular = GetColor(opaqueMode, GetRgbaColor(p.specular.Item), transpColor, transparency); } if (p.shininess != null && p.shininess.Item is common_float_or_param_typeFloat) { _shininess = (float)(p.shininess.Item as common_float_or_param_typeFloat).Value; } } else if (technique.Item is effectFx_profile_abstractProfile_COMMONTechniqueBlinn) // blinn { effectFx_profile_abstractProfile_COMMONTechniqueBlinn p = technique.Item as effectFx_profile_abstractProfile_COMMONTechniqueBlinn; if (p.transparent != null) { if (p.transparency != null) { if (p.transparency.Item is common_float_or_param_typeFloat) { opaqueMode = p.transparent.opaque; transpColor = GetRgbaColor(p.transparent.Item); transparency = (p.transparency.Item as common_float_or_param_typeFloat).Value; } } } if (p.ambient != null) { _ambient = GetColor(opaqueMode, GetRgbaColor(p.ambient.Item), transpColor, transparency); } if (p.diffuse != null) { _diffuse = GetColor(opaqueMode, GetRgbaColor(p.diffuse.Item), transpColor, transparency); } if (p.specular != null) { _specular = GetColor(opaqueMode, GetRgbaColor(p.specular.Item), transpColor, transparency); } if (p.shininess != null && p.shininess.Item is common_float_or_param_typeFloat) { _shininess = (float)(p.shininess.Item as common_float_or_param_typeFloat).Value; } } else if (technique.Item is effectFx_profile_abstractProfile_COMMONTechniqueLambert) // lambert { effectFx_profile_abstractProfile_COMMONTechniqueLambert p = technique.Item as effectFx_profile_abstractProfile_COMMONTechniqueLambert; if (p.transparent != null) { if (p.transparency != null) { if (p.transparency.Item is common_float_or_param_typeFloat) { opaqueMode = p.transparent.opaque; transpColor = GetRgbaColor(p.transparent.Item); transparency = (p.transparency.Item as common_float_or_param_typeFloat).Value; } } } if (p.ambient != null) { _ambient = GetColor(opaqueMode, GetRgbaColor(p.ambient.Item), transpColor, transparency); } if (p.diffuse != null) { _diffuse = GetColor(opaqueMode, GetRgbaColor(p.diffuse.Item), transpColor, transparency); } _specular = new DAEVector4(0.0f, 0.0f, 0.0f, 0.0f); } else if (technique.Item is effectFx_profile_abstractProfile_COMMONTechniqueConstant) // constant { effectFx_profile_abstractProfile_COMMONTechniqueConstant p = technique.Item as effectFx_profile_abstractProfile_COMMONTechniqueConstant; if (p.transparent != null) { if (p.transparency != null) { if (p.transparency.Item is common_float_or_param_typeFloat) { opaqueMode = p.transparent.opaque; transpColor = GetRgbaColor(p.transparent.Item); transparency = (p.transparency.Item as common_float_or_param_typeFloat).Value; } } } if (p.emission != null) { _ambient = GetColor(opaqueMode, GetRgbaColor(p.emission.Item), transpColor, transparency); _diffuse = GetColor(opaqueMode, GetRgbaColor(p.emission.Item), transpColor, transparency); _specular = GetColor(opaqueMode, GetRgbaColor(p.emission.Item), transpColor, transparency); _shininess = 0; } } _isTransparent = _diffuse.W < 1.0; } }
public common_transparent_type() { this.opaqueField = fx_opaque_enum.A_ONE; }