Ejemplo n.º 1
0
void DepthStencilRenderState::CopyFrom(const IRenderState& other)
{
	MEDUSA_ASSERT(other.Type() == Type(), "Cannot copy render state with different type");
	DepthStencilRenderState& val = (DepthStencilRenderState&)other;

	mDepthTestEnabled = val.mDepthTestEnabled;
	mDepthWritable = val.mDepthWritable;
	mDepthFunc = val.mDepthFunc;
	mDepthClearValue = val.mDepthClearValue;

	mStencilTestEnabled = val.mStencilTestEnabled;
	mStencilClearValue = val.mStencilClearValue;

	mFrontStencilDepthFailOp = val.mFrontStencilDepthFailOp;
	mFrontStencilFailOp = val.mFrontStencilFailOp;
	mFrontStencilFunc = val.mFrontStencilFunc;
	mFrontStencilPassOp = val.mFrontStencilPassOp;
	mFrontReadMask = val.mFrontReadMask;
	mFrontWriteMask = val.mFrontWriteMask;
	mFrontRefValue = val.mFrontRefValue;

	mBackStencilDepthFailOp = val.mBackStencilDepthFailOp;
	mBackStencilFailOp = val.mBackStencilFailOp;
	mBackStencilFunc = val.mBackStencilFunc;
	mBackStencilPassOp = val.mBackStencilPassOp;
	mBackReadMask = val.mBackReadMask;
	mBackWriteMask = val.mBackWriteMask;
	mBackRefValue = val.mBackRefValue;

}
Ejemplo n.º 2
0
void RasterizerRenderState::CopyFrom(const IRenderState& other)
{
	MEDUSA_ASSERT(other.Type() == Type(), "Cannot copy render state with different type");
	RasterizerRenderState& val = (RasterizerRenderState&)other;
	mCullMode = val.mCullMode;
	mFrontFace = val.mFrontFace;
	mCullFaceEnabled = val.mCullFaceEnabled;
	mColorMask = val.mColorMask;
}
Ejemplo n.º 3
0
void ShaderUniform::SetArray1(MemoryIntData data)
{
	MEDUSA_ASSERT(mDataType == GraphicsUniformDataType::Int || mDataType == GraphicsUniformDataType::Bool, "ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mIntData.IsContentEqual(data));
#endif
	Render::Instance().SetUniformArray1(mLocation, (uint)data.Size(), data.Data());
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mIntData = data;
#endif
}
Ejemplo n.º 4
0
void SamplerRenderState::CopyFrom(const IRenderState& other)
{
	MEDUSA_ASSERT(other.Type() == Type(), "Cannot copy render state with different type");
	SamplerRenderState& val = (SamplerRenderState&)other;
	mTextureType = val.mTextureType;
	mTextureUnit = val.mTextureUnit;
	mTexture = val.mTexture;
	mMagFilter = val.mMagFilter;
	mMinFilter = val.mMinFilter;
	mWrapS = val.mWrapS;
	mWrapT = val.mWrapT;
}
Ejemplo n.º 5
0
void ShaderConstant::SetArray4( uint count,const float* data )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::FloatVec4,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mFloatDataCount==count&&mFloatData==data);
#endif
	Render::Instance().SetUniformArray4(mLocation,count,data);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mFloatDataCount=count;
	mFloatData=data;
#endif
}
Ejemplo n.º 6
0
void ShaderConstant::Set( const Point2F& pos )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::FloatVec2,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&Math::IsEqual(mFloatArray[0],pos.X)&&Math::IsEqual(mFloatArray[1],pos.Y));
#endif
	Render::Instance().SetUniform(mLocation,pos.X,pos.Y);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mFloatArray[0]=pos.X;
	mFloatArray[1]=pos.Y;
#endif
}
Ejemplo n.º 7
0
void ShaderConstant::Set( float x )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::Float,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&Math::IsEqual(mFloatArray[0],x));
#endif

	Render::Instance().SetUniform(mLocation,x);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mFloatArray[0]=x;
#endif
}
Ejemplo n.º 8
0
void ShaderUniform::SetMatrix2(MemoryFloatData data, bool isTransposed/*=false*/)
{
	MEDUSA_ASSERT(mDataType == GraphicsUniformDataType::FloatMat2, "ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mFloatData.IsContentEqual(data)&&mIsTransposed==isTransposed);
#endif
	Render::Instance().SetUniformMatrix2(mLocation, (uint)data.Size() / sizeof(Matrix2), data.Data(), isTransposed);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mFloatData = data;
	mIsTransposed = isTransposed;
#endif
}
Ejemplo n.º 9
0
void ShaderConstant::Set( const Point3I& pos )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::IntVec3||mDataType==GraphicsUniformDataType::BoolVec3,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mIntArray[0]==pos.X&&mIntArray[1]==pos.Y&&mIntArray[2]==pos.Z);
#endif
	Render::Instance().SetUniform(mLocation,pos.X,pos.Y,pos.Z);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mIntArray[0]=pos.X;
	mIntArray[1]=pos.Y;
	mIntArray[2]=pos.Z;
#endif
}
Ejemplo n.º 10
0
void ShaderConstant::SetMatrix4( uint count,const float* data,bool isTransposed/*=false*/ )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::FloatMat4,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mFloatDataCount==count&&mFloatData==data&&mIsTransposed==isTransposed);
#endif
	Render::Instance().SetUniformMatrix4(mLocation,count,data,isTransposed);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mFloatDataCount=count;
	mFloatData=data;
	mIsTransposed=isTransposed;
#endif
}
Ejemplo n.º 11
0
void ShaderConstant::Set( const Color3F& color )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::FloatVec3,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&Math::IsEqual(mFloatArray[0],color.R)&&Math::IsEqual(mFloatArray[1],color.G)&&Math::IsEqual(mFloatArray[2],color.B));
#endif
	Render::Instance().SetUniform(mLocation,color.R,color.G,color.B);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mFloatArray[0]=color.R;
	mFloatArray[1]=color.G;
	mFloatArray[2]=color.B;
#endif
}
Ejemplo n.º 12
0
void ShaderConstant::Set( const Color4B& color )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::IntVec4||mDataType==GraphicsUniformDataType::BoolVec4,"ErrorDataType");
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mIntArray[0]==(int)color.R&&mIntArray[1]==(int)color.G&&mIntArray[2]==(int)color.B&&mIntArray[3]==color.A);
#endif
	Render::Instance().SetUniform(mLocation,color.R,color.G,color.B,color.A);
	MarkAssigned();
#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mIntArray[0]=color.R;
	mIntArray[1]=color.G;
	mIntArray[2]=color.B;
	mIntArray[3]=color.A;
#endif
}
Ejemplo n.º 13
0
void ShaderConstant::Set( int x )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::Bool
		||mDataType==GraphicsUniformDataType::Int
		||mDataType==GraphicsUniformDataType::Sampler2D
		||mDataType==GraphicsUniformDataType::SamplerCube,"ErrorDataType");

#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	RETURN_IF_TRUE(mIsAssigned&&mIntArray[0]==x);
#endif
	Render::Instance().SetUniform(mLocation,x);
	MarkAssigned();

#ifdef MEDUSA_RENDER_STATE_CACHE_ENABLED
	mIntArray[0]=x;
#endif

}
Ejemplo n.º 14
0
void ShaderConstant::SetMatrix( const Matrix4& matrix )
{
	MEDUSA_ASSERT(mDataType==GraphicsUniformDataType::FloatMat4,"ErrorDataType");
	SetMatrix4(1,matrix.Items());
}
Ejemplo n.º 15
0
void ShaderUniform::SetMatrix(const Matrix4& matrix)
{
	MEDUSA_ASSERT(mDataType == GraphicsUniformDataType::FloatMat4, "ErrorDataType");
	SetMatrix4(MemoryFloatData::FromStatic(matrix.Items(), 16 * sizeof(float)));
}
Ejemplo n.º 16
0
void ProgramRenderState::CopyFrom(const IRenderState& other)
{
	MEDUSA_ASSERT(other.Type() == Type(), "Cannot copy render state with different type");
	ProgramRenderState& val = (ProgramRenderState&)other;
	mProgram = val.mProgram;
}