
extern "C" {

	void* IrrScene_IVertexBuffer_getData(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return vbuf->getData();
		else return 0;
	}

	s32 IrrScene_IVertexBuffer_getType(IVertexBuffer* vbuf) // returns E_VERTEX_TYPE
	{
		if (vbuf)
			return vbuf->getType();
		else return -1;
	}
	
	void IrrScene_IVertexBuffer_setType(IVertexBuffer* vbuf, E_VERTEX_TYPE IndexType)
	{
		if (vbuf)
			vbuf->setType(IndexType);
	}

	u32 IrrScene_IVertexBuffer_stride(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return vbuf->stride();
		else return 0;
	}

	u32 IrrScene_IVertexBuffer_size(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return vbuf->size();
		else return 0;
	}
	
	void IrrScene_IVertexBuffer_push_back(IVertexBuffer* vbuf, S3DVertex* element)
	{
		if (vbuf)
			vbuf->push_back(*element);
	}
		
	// do not delete
	S3DVertex* IrrScene_IVertexBuffer_elementAt(IVertexBuffer* vbuf, u32 index)
	{
		if (vbuf)
			return &(*vbuf)[index];
		else return 0;
	}
	
	// do not delete
	S3DVertex* IrrScene_IVertexBuffer_getLast(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return &(vbuf->getLast());
		else return 0;
	}
	
	void IrrScene_IVertexBuffer_set_used(IVertexBuffer* vbuf, u32 usedNow)
	{
		if (vbuf)
			vbuf->set_used(usedNow);
	}
	
	void IrrScene_IVertexBuffer_reallocate(IVertexBuffer* vbuf, u32 new_size)
	{
		if (vbuf)
			vbuf->reallocate(new_size);
	}
	
	u32 IrrScene_IVertexBuffer_allocated_size(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return vbuf->allocated_size();
		else return 0;
	}

	s32 IrrScene_IVertexBuffer_pointerOut(IVertexBuffer* vbuf, u32** outPtrs)
	{
		if (vbuf) {
		
			s32 size = vbuf->size();
			
			Irr_ptrarray_allocate(outPtrs,size);
			
			for (int i=0; i<size; i++) {
				((u32*)*outPtrs)[i]=(u32)&(*vbuf)[i];
			}

			return size;
		} else return 0;
	}

	S3DVertex* IrrScene_IVertexBuffer_pointer(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return vbuf->pointer();
		else return 0;
	}

	s32 IrrScene_IVertexBuffer_getHardwareMappingHint(IVertexBuffer* vbuf) // returns E_HARDWARE_MAPPING 
	{
		if (vbuf)
			return vbuf->getHardwareMappingHint();
		else return -1;
	}

	void IrrScene_IVertexBuffer_setHardwareMappingHint(IVertexBuffer* vbuf, E_HARDWARE_MAPPING NewMappingHint)
	{
		if (vbuf)
			vbuf->setHardwareMappingHint(NewMappingHint);
	}

	void IrrScene_IVertexBuffer_setDirty(IVertexBuffer* vbuf)
	{
		if (vbuf)
			vbuf->setDirty();
	}
	
	u32 IrrScene_IVertexBuffer_getChangedID(IVertexBuffer* vbuf)
	{
		if (vbuf)
			return vbuf->getChangedID();
		else return 0;
	}

	bool IrrScene_IVertexBuffer_drop(IVertexBuffer* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrScene_IVertexBuffer_getDebugName(IVertexBuffer* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrScene_IVertexBuffer_grab(IVertexBuffer* unk)
	{
		if (unk)
			unk->grab();
	}
}