! * \brief Builds the material from a parameter list * * \param matData Data information for the material * \param matParams Additional parameters for the material */
| 110 | * \param matParams Additional parameters for the material |
| 111 | */ |
| 112 | void Material::BuildFromParameters(const ParameterList& matData, const MaterialParams& matParams) |
| 113 | { |
| 114 | Color color; |
| 115 | bool isEnabled; |
| 116 | double dValue; |
| 117 | long long iValue; |
| 118 | String path; |
| 119 | |
| 120 | ErrorFlags errFlags(ErrorFlag_Silent | ErrorFlag_ThrowExceptionDisabled, true); |
| 121 | |
| 122 | if (matData.GetDoubleParameter(MaterialData::AlphaThreshold, &dValue)) |
| 123 | SetAlphaThreshold(float(dValue)); |
| 124 | |
| 125 | if (matData.GetBooleanParameter(MaterialData::AlphaTest, &isEnabled)) |
| 126 | EnableAlphaTest(isEnabled); |
| 127 | |
| 128 | if (matData.GetColorParameter(MaterialData::AmbientColor, &color)) |
| 129 | SetAmbientColor(color); |
| 130 | |
| 131 | if (matData.GetIntegerParameter(MaterialData::CullingSide, &iValue)) |
| 132 | SetFaceCulling(static_cast<FaceSide>(iValue)); |
| 133 | |
| 134 | if (matData.GetIntegerParameter(MaterialData::DepthFunc, &iValue)) |
| 135 | SetDepthFunc(static_cast<RendererComparison>(iValue)); |
| 136 | |
| 137 | if (matData.GetBooleanParameter(MaterialData::DepthSorting, &isEnabled)) |
| 138 | EnableDepthSorting(isEnabled); |
| 139 | |
| 140 | if (matData.GetColorParameter(MaterialData::DiffuseColor, &color)) |
| 141 | SetDiffuseColor(color); |
| 142 | |
| 143 | if (matData.GetIntegerParameter(MaterialData::DstBlend, &iValue)) |
| 144 | SetDstBlend(static_cast<BlendFunc>(iValue)); |
| 145 | |
| 146 | if (matData.GetIntegerParameter(MaterialData::FaceFilling, &iValue)) |
| 147 | SetFaceFilling(static_cast<FaceFilling>(iValue)); |
| 148 | |
| 149 | if (matData.GetDoubleParameter(MaterialData::LineWidth, &dValue)) |
| 150 | SetLineWidth(float(dValue)); |
| 151 | |
| 152 | if (matData.GetDoubleParameter(MaterialData::PointSize, &dValue)) |
| 153 | SetPointSize(float(dValue)); |
| 154 | |
| 155 | if (matData.GetColorParameter(MaterialData::SpecularColor, &color)) |
| 156 | SetSpecularColor(color); |
| 157 | |
| 158 | if (matData.GetDoubleParameter(MaterialData::Shininess, &dValue)) |
| 159 | SetShininess(float(dValue)); |
| 160 | |
| 161 | if (matData.GetIntegerParameter(MaterialData::SrcBlend, &iValue)) |
| 162 | SetSrcBlend(static_cast<BlendFunc>(iValue)); |
| 163 | |
| 164 | // RendererParameter |
| 165 | if (matData.GetBooleanParameter(MaterialData::Blending, &isEnabled)) |
| 166 | EnableBlending(isEnabled); |
| 167 | |
| 168 | if (matData.GetBooleanParameter(MaterialData::ColorWrite, &isEnabled)) |
| 169 | EnableColorWrite(isEnabled); |
no test coverage detected