增加材质和纹理
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "dvc_config.h"
|
||||
#include "dvc_pre_declare.h"
|
||||
#include "math/dvc_vector2.h"
|
||||
#include "math/dvc_vector4.h"
|
||||
|
||||
DV_CORE_BEGIN_NAMESPACE
|
||||
|
||||
class shader
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
static inline int32_t step(const T& edge, const T& x) {
|
||||
return (x >= edge) ? 1 : 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline T max(const T& a, const T& b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline T pow(const T& base, const T& exponent) {
|
||||
return std::pow(base, exponent);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline T min(const T& a, const T& b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
static DV_CORE_API fVector4 texture2D(const RenderPipe& pipe, const char* textName, const fVector2& uv, const fVector4& defaultValue);
|
||||
};
|
||||
|
||||
DV_CORE_END_NAMESPACE
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "dvc_config.h"
|
||||
#include "dvc_pre_declare.h"
|
||||
#include "math/dvc_vector2.h"
|
||||
#include "math/dvc_vector3.h"
|
||||
#include "math/dvc_vector4.h"
|
||||
#include "device/dvc_vertex_desc.h"
|
||||
@@ -15,7 +16,7 @@ public:
|
||||
virtual const VertexDesc& getOutputVertexDesc() const = 0;
|
||||
|
||||
typedef std::function<DeviceBufferAccessorConstPtr(VertexElementType)> SetInputAttributeFunc;
|
||||
virtual void prepare(const UniformBuffer* uniformBuffer, SetInputAttributeFunc setInputAttributeFunc) = 0;
|
||||
virtual void prepare(const RenderPipe* pipe, SetInputAttributeFunc setInputAttributeFunc) = 0;
|
||||
|
||||
virtual void process(size_t index, void* outputVertex, fVector3& vertexWorldPos) = 0;
|
||||
};
|
||||
@@ -26,7 +27,7 @@ public:
|
||||
virtual const char* getName(void) const = 0;
|
||||
|
||||
typedef std::function<size_t(const std::string&)> SetInputAttributeFunc;
|
||||
virtual void prepare(const UniformBuffer* uniformBuffer, SetInputAttributeFunc setInputAttributeFunc) = 0;
|
||||
virtual void prepare(const RenderPipe* pipe, SetInputAttributeFunc setInputAttributeFunc) = 0;
|
||||
|
||||
virtual void process(const VertexDesc& veretexDesc, const float32_t* pixelData, fVector4& color) = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user