| 38 | // Construct material, set up vertex info etc |
| 39 | // |
| 40 | Material::Material(AssetPtr<ShaderData> const shader, |
| 41 | E_DrawType const drawType, |
| 42 | T_ParameterBlock const defaultParameters, |
| 43 | std::vector<AssetPtr<TextureData>> const& textureReferences |
| 44 | ) |
| 45 | : I_Material() |
| 46 | , m_Shader(shader) |
| 47 | , m_DrawType(drawType) |
| 48 | , m_DefaultParameters(defaultParameters) |
| 49 | , m_TextureReferences(textureReferences) |
| 50 | { |
| 51 | ET_ASSERT(m_Shader != nullptr); |
| 52 | |
| 53 | // determine layout flags and locations |
| 54 | std::vector<ShaderData::T_AttributeLocation> const& attributes = m_Shader->GetAttributes(); |
| 55 | |
| 56 | for (auto it = AttributeDescriptor::s_VertexAttributes.begin(); it != AttributeDescriptor::s_VertexAttributes.end(); ++it) |
| 57 | { |
| 58 | auto const attribIt = std::find_if(attributes.cbegin(), attributes.cend(), [it](ShaderData::T_AttributeLocation const& loc) |
| 59 | { |
| 60 | return it->second.name == loc.second.name; |
| 61 | }); |
| 62 | |
| 63 | if (attribIt != attributes.cend()) |
| 64 | { |
| 65 | m_AttributeLocations.emplace_back(attribIt->first); |
| 66 | m_LayoutFlags |= it->first; |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | //-------------------------- |
| 72 | // Material::d-tor |
nothing calls this directly
no test coverage detected