コード例 #1
0
//! (static)
Util::Reference<TexCoordAttributeAccessor> TexCoordAttributeAccessor::create(MeshVertexData & _vData, Util::StringIdentifier name) {
    const VertexAttribute & attr = assertAttribute(_vData, name);
    if(attr.getNumValues() == 2 && attr.getDataType() == GL_FLOAT) {
        return new TexCoordAttributeAccessor(_vData, attr);
    } else {
        throw std::invalid_argument(unimplementedFormatMsg + name.toString() + '\'');
    }
}
コード例 #2
0
//! (static)
Util::Reference<UIntAttributeAccessor> UIntAttributeAccessor::create(MeshVertexData & _vData, Util::StringIdentifier name) {
	const VertexAttribute & attr = assertAttribute(_vData, name);
	if(attr.getDataType() == GL_UNSIGNED_INT) {
		return new UIntAttributeAccessor(_vData, attr);
	} else {
		throw std::invalid_argument(unimplementedFormatMsg + name.toString() + '\'');
	}
}
コード例 #3
0
//! (static) Factory
Util::Reference<ColorAttributeAccessor> ColorAttributeAccessor::create(MeshVertexData & _vData, Util::StringIdentifier name) {
    const VertexAttribute & attr = assertAttribute(_vData, name);
    if(attr.getNumValues() >= 4 && attr.getDataType() == GL_FLOAT) {
        return new ColorAttributeAccessor4f(_vData, attr);
    } else if(attr.getNumValues() >= 3 && attr.getDataType() == GL_FLOAT) {
        return new ColorAttributeAccessor3f(_vData, attr);
    } else if(attr.getNumValues() >= 4 && attr.getDataType() == GL_UNSIGNED_BYTE) {
        return new ColorAttributeAccessor4ub(_vData, attr);
    } else {
        throw std::invalid_argument(unimplementedFormatMsg + name.toString() + '\'');
    }
}