------------------------------------------------------------------------------------------------
| 136 | |
| 137 | // ------------------------------------------------------------------------------------------------ |
| 138 | Texture::Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name) : |
| 139 | Object(id,element,name), |
| 140 | uvTrans(0.0f, 0.0f), |
| 141 | uvScaling(1.0f,1.0f), |
| 142 | uvRotation(0.0f), |
| 143 | type(), |
| 144 | relativeFileName(), |
| 145 | fileName(), |
| 146 | alphaSource(), |
| 147 | props(), |
| 148 | media(nullptr) { |
| 149 | const Scope& sc = GetRequiredScope(element); |
| 150 | |
| 151 | const Element* const Type = sc["Type"]; |
| 152 | const Element* const FileName = sc["FileName"]; |
| 153 | const Element* const RelativeFilename = sc["RelativeFilename"]; |
| 154 | const Element* const ModelUVTranslation = sc["ModelUVTranslation"]; |
| 155 | const Element* const ModelUVScaling = sc["ModelUVScaling"]; |
| 156 | const Element* const Texture_Alpha_Source = sc["Texture_Alpha_Source"]; |
| 157 | const Element* const Cropping = sc["Cropping"]; |
| 158 | |
| 159 | if(Type) { |
| 160 | type = ParseTokenAsString(GetRequiredToken(*Type,0)); |
| 161 | } |
| 162 | |
| 163 | if(FileName) { |
| 164 | fileName = ParseTokenAsString(GetRequiredToken(*FileName,0)); |
| 165 | } |
| 166 | |
| 167 | if(RelativeFilename) { |
| 168 | relativeFileName = ParseTokenAsString(GetRequiredToken(*RelativeFilename,0)); |
| 169 | } |
| 170 | |
| 171 | if(ModelUVTranslation) { |
| 172 | uvTrans = aiVector2D(ParseTokenAsFloat(GetRequiredToken(*ModelUVTranslation,0)), |
| 173 | ParseTokenAsFloat(GetRequiredToken(*ModelUVTranslation,1)) |
| 174 | ); |
| 175 | } |
| 176 | |
| 177 | if(ModelUVScaling) { |
| 178 | uvScaling = aiVector2D(ParseTokenAsFloat(GetRequiredToken(*ModelUVScaling,0)), |
| 179 | ParseTokenAsFloat(GetRequiredToken(*ModelUVScaling,1)) |
| 180 | ); |
| 181 | } |
| 182 | |
| 183 | if(Cropping) { |
| 184 | crop[0] = ParseTokenAsInt(GetRequiredToken(*Cropping,0)); |
| 185 | crop[1] = ParseTokenAsInt(GetRequiredToken(*Cropping,1)); |
| 186 | crop[2] = ParseTokenAsInt(GetRequiredToken(*Cropping,2)); |
| 187 | crop[3] = ParseTokenAsInt(GetRequiredToken(*Cropping,3)); |
| 188 | } else { |
| 189 | // vc8 doesn't support the crop() syntax in initialization lists |
| 190 | // (and vc9 WARNS about the new (i.e. compliant) behaviour). |
| 191 | crop[0] = crop[1] = crop[2] = crop[3] = 0; |
| 192 | } |
| 193 | |
| 194 | if(Texture_Alpha_Source) { |
| 195 | alphaSource = ParseTokenAsString(GetRequiredToken(*Texture_Alpha_Source,0)); |
nothing calls this directly
no test coverage detected