Added IndexMapper

Former-commit-id: 994b30f41161855827d920b6c128a5bbd480929b
This commit is contained in:
Lynix
2013-01-03 21:26:51 +01:00
parent 6fb221b479
commit 9c76c78c0c
2 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_VERTEXITERATOR_HPP
#define NAZARA_VERTEXITERATOR_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/BufferMapper.hpp>
class NzIndexBuffer;
class NzSubMesh;
using NzIndexMapperGetter = nzUInt32 (*)(const void* buffer, unsigned int i);
using NzIndexMapperSetter = void (*)(void* buffer, unsigned int i, nzUInt32 value);
class NAZARA_API NzIndexMapper
{
public:
NzIndexMapper(NzIndexBuffer* indexBuffer, nzBufferAccess access = nzBufferAccess_ReadWrite);
NzIndexMapper(const NzIndexBuffer* indexBuffer);
NzIndexMapper(const NzSubMesh* subMesh);
~NzIndexMapper() = default;
nzUInt32 Get(unsigned int i) const;
void Set(unsigned int i, nzUInt32 value);
void Unmap();
private:
NzBufferMapper<NzIndexBuffer> m_mapper;
NzIndexMapperGetter m_getter;
NzIndexMapperSetter m_setter;
};
#endif // NAZARA_VERTEXITERATOR_HPP