Initial commit
This commit is contained in:
106
Include/ZRenderer/ZVertexParams.hpp
Normal file
106
Include/ZRenderer/ZVertexParams.hpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
ZVertexParams.hpp
|
||||
Author: James Russell <jcrussell@762studios.com>
|
||||
Created: 7/1/2012
|
||||
|
||||
Purpose:
|
||||
|
||||
TODO
|
||||
|
||||
License:
|
||||
|
||||
TODO
|
||||
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _ZVERTEXPARAMS_HPP
|
||||
#define _ZVERTEXPARAMS_HPP
|
||||
|
||||
#include <ZRenderer/ZDrawParams.hpp>
|
||||
|
||||
#include <ZSTL/ZSTL.hpp>
|
||||
|
||||
#include <ZUtil/ZUtil.hpp>
|
||||
|
||||
#include <ZRenderer/ZDataBuffer.hpp>
|
||||
|
||||
#ifndef ZVP_MAX_STREAMS
|
||||
#define ZVP_MAX_STREAMS (128)
|
||||
#endif
|
||||
|
||||
class ZVertexParams : public ZDrawParams
|
||||
{
|
||||
private:
|
||||
//A binding for a vertex stream
|
||||
struct VertexStreamBinding
|
||||
{
|
||||
ZName Name; //Name of the stream attribute
|
||||
ZPair<ZDataBuffer*, const ZDataBufferStream*> Binding; //Pair Binding
|
||||
};
|
||||
|
||||
//This is the bound vertex buffer and streams
|
||||
ZPtr<ZDataBuffer> VertexBuffer;
|
||||
VertexStreamBinding VertexStreams[ZVP_MAX_STREAMS];
|
||||
|
||||
//Our current set number of streams
|
||||
size_t CurrentStreamCount;
|
||||
|
||||
protected:
|
||||
//Does this vertex parameter object need to be updated before rendered with?
|
||||
bool Dirty;
|
||||
|
||||
public:
|
||||
/*
|
||||
Default Constructor.
|
||||
*/
|
||||
ZVertexParams();
|
||||
|
||||
/*
|
||||
public ZVertexParams::ClearStreams
|
||||
|
||||
Clears the list of currently set streams.
|
||||
|
||||
@return (void)
|
||||
@context (all)
|
||||
*/
|
||||
void ClearVertexStreams();
|
||||
|
||||
/*
|
||||
public ZVertexParams::SetStream
|
||||
|
||||
Sets a vertex buffer stream. The vertex buffer provided to each call
|
||||
of 'SetVertexStream' must be the same.
|
||||
|
||||
@param _name - the name of the stream binding
|
||||
@param _vertexBuffer - the vertex buffer to bind streams from
|
||||
@param _stream - the stream definition
|
||||
@return (void)
|
||||
@context (all)
|
||||
*/
|
||||
void SetVertexStream(const ZName& _name, ZPtr<ZDataBuffer> _vertexBuffer, const ZDataBufferStream* _stream);
|
||||
|
||||
/*
|
||||
The following methods are used by the renderer to get the values needed when
|
||||
binding shader parameter values to pass to the shader program, to mark
|
||||
all bound resources as contended, and release contention.
|
||||
*/
|
||||
const ZPair<ZDataBuffer*, const ZDataBufferStream*>* GetStreamByName(const ZName& _name);
|
||||
|
||||
|
||||
ZDataBuffer* GetVertexBuffer();
|
||||
|
||||
bool IsDirty() const { return Dirty; }
|
||||
|
||||
size_t GetStreamCount() const { return CurrentStreamCount; }
|
||||
|
||||
//Subclass Override
|
||||
virtual void MarkResourcesContended();
|
||||
|
||||
//Subclass Override
|
||||
virtual void ReleaseResourceContention();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user