mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-19 06:51:09 +00:00
Misc adjustments to make the cherry-picked 'C# shader resources' commit work
This commit is contained in:
parent
2390b56b29
commit
a21edf78da
5 changed files with 11 additions and 11 deletions
|
@ -105,7 +105,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
public void DeclareShader(ShaderName name, string vertResourceName, string fragResourceName)
|
||||
{
|
||||
RenderDevice_DeclareShader(Handle, name, GetResourceText(vertResourceName), GetResourceText(fragResourceName));
|
||||
RenderDevice_DeclareShader(Handle, name, name.ToString(), GetResourceText(vertResourceName), GetResourceText(fragResourceName));
|
||||
}
|
||||
|
||||
static string GetResourceText(string name)
|
||||
|
@ -426,7 +426,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
static extern void RenderDevice_Delete(IntPtr handle);
|
||||
|
||||
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
static extern void RenderDevice_DeclareShader(IntPtr handle, ShaderName name, string vertexShader, string fragShader);
|
||||
static extern void RenderDevice_DeclareShader(IntPtr handle, ShaderName index, string name, string vertexShader, string fragShader);
|
||||
|
||||
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr RenderDevice_GetError(IntPtr handle);
|
||||
|
|
|
@ -109,10 +109,10 @@ RenderDevice::~RenderDevice()
|
|||
}
|
||||
}
|
||||
|
||||
void RenderDevice::DeclareShader(ShaderName shadername, const char* vertexshader, const char* fragmentshader)
|
||||
void RenderDevice::DeclareShader(ShaderName index, const char* name, const char* vertexshader, const char* fragmentshader)
|
||||
{
|
||||
if (!mContextIsCurrent) Context->MakeCurrent();
|
||||
mShaderManager->DeclareShader(shadername, vertexshader, fragmentshader);
|
||||
mShaderManager->DeclareShader(index, name, vertexshader, fragmentshader);
|
||||
}
|
||||
|
||||
void RenderDevice::SetVertexBuffer(VertexBuffer* buffer)
|
||||
|
@ -865,9 +865,9 @@ const char* RenderDevice_GetError(RenderDevice* device)
|
|||
return device->GetError();
|
||||
}
|
||||
|
||||
void RenderDevice_DeclareShader(RenderDevice* device, ShaderName name, const char* vertexshader, const char* fragmentshader)
|
||||
void RenderDevice_DeclareShader(RenderDevice* device, ShaderName index, const char* name, const char* vertexshader, const char* fragmentshader)
|
||||
{
|
||||
device->DeclareShader(name, vertexshader, fragmentshader);
|
||||
device->DeclareShader(index, name, vertexshader, fragmentshader);
|
||||
}
|
||||
|
||||
void RenderDevice_SetShader(RenderDevice* device, ShaderName name)
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
RenderDevice(void* disp, void* window);
|
||||
~RenderDevice();
|
||||
|
||||
void DeclareShader(ShaderName shadername, const char* vertexshader, const char* fragmentshader);
|
||||
void DeclareShader(ShaderName index, const char* name, const char* vertexshader, const char* fragmentshader);
|
||||
void SetShader(ShaderName name);
|
||||
void SetUniform(UniformName name, const void* values, int count);
|
||||
void SetVertexBuffer(VertexBuffer* buffer);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "Precomp.h"
|
||||
#include "ShaderManager.h"
|
||||
|
||||
void ShaderManager::DeclareShader(int i, const char* vs, const char* ps)
|
||||
void ShaderManager::DeclareShader(int i, const char* name, const char* vs, const char* ps)
|
||||
{
|
||||
if (Shaders.size() <= (size_t)i)
|
||||
{
|
||||
|
@ -10,8 +10,8 @@ void ShaderManager::DeclareShader(int i, const char* vs, const char* ps)
|
|||
AlphaTestShaders.resize((size_t)i + 1);
|
||||
}
|
||||
|
||||
Shaders[i].Setup(vs, ps, false);
|
||||
AlphaTestShaders[i].Setup(vs, ps, true);
|
||||
Shaders[i].Setup(name, vs, ps, false);
|
||||
AlphaTestShaders[i].Setup(name, vs, ps, true);
|
||||
}
|
||||
|
||||
void ShaderManager::ReleaseResources()
|
||||
|
|
|
@ -7,7 +7,7 @@ class ShaderManager
|
|||
public:
|
||||
void ReleaseResources();
|
||||
|
||||
void DeclareShader(int index, const char* vs, const char* ps);
|
||||
void DeclareShader(int index, const char* name, const char* vs, const char* ps);
|
||||
|
||||
std::vector<Shader> AlphaTestShaders;
|
||||
std::vector<Shader> Shaders;
|
||||
|
|
Loading…
Reference in a new issue