Commit 521701ef authored by D-AIRY's avatar D-AIRY

continue

parent 7b363067
[submodule "sdks/bullet3"]
path = sdks/bullet3
url = https://root@dev.ds-servers.com/sip/bullet3.git
url = https://dev.ds-servers.com/sip/bullet3.git
[submodule "source/common"]
path = source/common
url = https://root@dev.ds-servers.com/sip/common.git
url = https://dev.ds-servers.com/sip/common.git
[submodule "sdks/graphix"]
path = sdks/graphix
url = https://root@dev.ds-servers.com/sip/graphix.git
url = https://dev.ds-servers.com/sip/graphix.git
/*
gui_main.ps
*/
#include <../struct.h>
//##########################################################################
sampler2D g_sDiffuse: register(s0);
//##########################################################################
half4 g_vColor;
//##########################################################################
half4 main(VSO_GUITextured IN):COLOR0
{
half4 vFinalColor = tex2D(g_sDiffuse, IN.vTexUV);
vFinalColor *= g_vColor;
return(vFinalColor);
}
/*
gui_main.vs
*/
#include <../struct.h>
//##########################################################################
half4x4 g_mWVP;
//##########################################################################
VSO_GUITextured main(VSI_GUITextured IN)
{
VSO_GUITextured OUT = (VSO_GUITextured)0;
OUT.vPosition = mul(half4(IN.vPosition.xyz,1), g_mWVP);
OUT.vTexUV = IN.vTexUV;
return(OUT);
}
/*
gui_main_textransform.vs
*/
#include <../struct.h>
//##########################################################################
half4x4 g_mWVP;
half2 g_vTxTransform;
//##########################################################################
VSO_GUITextured main(VSI_GUITextured IN)
{
VSO_GUITextured OUT = (VSO_GUITextured)0;
OUT.vPosition = mul(half4(IN.vPosition.xyz,1), g_mWVP);
OUT.vTexUV = IN.vTexUV + g_vTxTransform;
return(OUT);
}
/*
gui_simple.ps
*/
#include <../struct.h>
//##########################################################################
half4 g_vColor;
//##########################################################################
half4 main(VSO_GUISimple IN):COLOR0
{
half4 vFinalColor = g_vColor;
return(vFinalColor);
}
/*
gui_simple.vs
*/
#include <../struct.h>
//##########################################################################
half4x4 g_mWVP;
//##########################################################################
VSO_GUISimple main(VSI_GUISimple IN)
{
VSO_GUISimple OUT = (VSO_GUISimple)0;
OUT.vPosition = mul(half4(IN.vPosition.xyz,1), g_mWVP);
return(OUT);
}
Subproject commit c248ce8257d09b941482b11e598734798d884880
Subproject commit 8269ffe9f4d254ad77eca2b2ee45c8907cab596e
This diff is collapsed.
......@@ -458,6 +458,8 @@ protected:
//! пиксельный шейдер
ID m_idPS;
ID m_idShaderKit;
//! текстура для ограничивающих объемов
ID m_idTexBB;
......@@ -546,6 +548,9 @@ protected:
//! вершинный буфер с данными трансформаций
IGXVertexBuffer *m_pTransVertBuf;
//!
IGXRenderBuffer *m_pRenderBuffer = NULL;
//! меш главного ограничивающего объема
IMesh *m_pBoundBox;
......
......@@ -134,13 +134,13 @@ SX_LIB_API void SAIG_AKill();
/*! цвет главного ограничивающего объема */
#define AIGRID_COLOR_GBBOX D3DCOLOR_ARGB(128, 0, 255, 0)
#define AIGRID_COLOR_GBBOX GXCOLOR_ARGB(128, 0, 255, 0)
/*! цвет выделенного квада */
#define AIGRID_COLOR_SEL_MAIN D3DCOLOR_ARGB(220, 255, 255, 255)
#define AIGRID_COLOR_SEL_MAIN GXCOLOR_ARGB(220, 255, 255, 255)
/*! цвет соседей (прямых) выделенного квада */
#define AIGRID_COLOR_SEL_ADD D3DCOLOR_ARGB(100, 255, 255, 255)
#define AIGRID_COLOR_SEL_ADD GXCOLOR_ARGB(100, 255, 255, 255)
//! состояния занятости квада
enum AIQUAD_STATE
......
......@@ -1479,8 +1479,9 @@ void Animation::RenderSkeleton(int hlBone)
verts[i * 2 + 1].pos = pos;
verts[i * 2].color = verts[i * 2 + 1].color = hlBone == i ? 0xFFFF00FF : 0xFF0000FF;
}
#ifdef _GRAPHIX_API
DX_CALL(m_pMgr->m_pd3dDevice->DrawPrimitiveUP(D3DPT_LINELIST, m_iBoneCount - 1, verts + 2, sizeof(verts[0])));
#endif
mem_delete_a(verts);
}
......@@ -1686,7 +1687,9 @@ void Animation::render()
}
if(!(m_pMdl->m_hdr.iFlags & MODEL_FLAG_STATIC))
{
#ifdef _GRAPHIX_API
DX_CALL(m_pMgr->m_pd3dDevice->SetVertexShaderConstantF(16, (float*)m_pBoneMatrixRender, sizeof(ModelBoneShader)* m_iBoneCount / sizeof(float) / 4));
#endif
}
m_pMdl->render(&(getWorldTM()), m_iCurrentSkin, 0, m_idOverrideMaterial, &m_vGlowColor, m_isGlowEnabled);
......
......@@ -58,24 +58,37 @@ namespace gui
void CDesktop::createRenderTarget()
{
DX_CALL(GetGUI()->getDevice()->CreateRenderTarget(m_iWidth, m_iHeight, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_4_SAMPLES, 0, FALSE, &m_pRenderSurface, NULL));
m_pRenderSurface = GetGUI()->getDevice()->createColorTarget(m_iWidth, m_iHeight, GXFMT_A8R8G8B8, GXMULTISAMPLE_4_SAMPLES);
m_pDepthStencilSurface = GetGUI()->getDevice()->createDepthStencilSurface(m_iWidth, m_iHeight, GXFMT_D24S8, GXMULTISAMPLE_4_SAMPLES);
m_txFinal = CTextureManager::createTexture(StringW(L"@") + m_sName, m_iWidth, m_iHeight, 32, true);
struct point
{
float x;
float y;
float z;
float tx;
float ty;
};
point a[] = {
{0, 0, 0, 0.0f, 0.0f},
{m_iWidth, 0, 0, 1.0f, 0.0f},
{m_iWidth, m_iHeight, 0, 1.0f, 1.0f},
{0, m_iHeight, 0, 0.0f, 1.0f}
};
m_pVertices = GetGUI()->getDevice()->createVertexBuffer(sizeof(point) * 4, GX_BUFFER_USAGE_STATIC | GX_BUFFER_WRITEONLY, a);
m_pRenderBuffer = GetGUI()->getDevice()->createRenderBuffer(1, &m_pVertices, GetGUI()->getVertexDeclarations()->m_pXYZTex);
}
void CDesktop::releaseRenderTarget()
{
if(m_pRenderSurface)
{
m_pRenderSurface->Release();
m_pRenderSurface = NULL;
}
if(m_pDepthStencilSurface)
{
m_pDepthStencilSurface->Release();
m_pDepthStencilSurface = NULL;
}
mem_release(m_pRenderBuffer);
mem_release(m_pVertices);
mem_release(m_pRenderSurface);
mem_release(m_pDepthStencilSurface);
if(m_txFinal)
{
CTextureManager::unloadTexture(m_txFinal);
......@@ -95,10 +108,10 @@ namespace gui
if(m_pDoc->isDirty())
{
CTextureManager::bindTexture(NULL);
IDirect3DSurface9 *pOldRT;
IDirect3DSurface9 *pOldDS;
DX_CALL(GetGUI()->getDevice()->GetRenderTarget(0, &pOldRT));
DX_CALL(GetGUI()->getDevice()->SetRenderTarget(0, m_pRenderSurface));
IGXSurface *pOldRT;
IGXDepthStencilSurface *pOldDS;
pOldRT = GetGUI()->getDevice()->getColorTarget();
GetGUI()->getDevice()->setColorTarget(m_pRenderSurface);
pOldDS = GetGUI()->getDevice()->getDepthStencilSurface();
GetGUI()->getDevice()->setDepthStencilSurface(m_pDepthStencilSurface);
......@@ -106,28 +119,28 @@ namespace gui
//GetGUI()->getDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
//GetGUI()->getDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
GetGUI()->getDevice()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
GetGUI()->getDevice()->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
GetGUI()->getDevice()->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
GetGUI()->getDevice()->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_MAX);
// GetGUI()->getDevice()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
// GetGUI()->getDevice()->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
// GetGUI()->getDevice()->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
// GetGUI()->getDevice()->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_MAX);
GetGUI()->getDevice()->setBlendState(GetGUI()->getBlendStates()->m_pDesktop);
m_pDoc->render();
GetGUI()->getDevice()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
DX_CALL(GetGUI()->getDevice()->SetRenderTarget(0, pOldRT));
GetGUI()->getDevice()->setBlendState(GetGUI()->getBlendStates()->m_pDefault);
// GetGUI()->getDevice()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
GetGUI()->getDevice()->setColorTarget(pOldRT);
GetGUI()->getDevice()->setDepthStencilSurface(pOldDS);
pOldRT->Release();
pOldDS->Release();
mem_release(pOldRT);
mem_release(pOldDS);
//D3DXSaveSurfaceToFileA("../screenshots/gui.png", D3DXIFF_PNG, m_pRenderSurface, NULL, NULL);
IDirect3DSurface9 *pNewSurface;
DX_CALL(m_txFinal->getAPItexture()->GetSurfaceLevel(0, &pNewSurface));
DX_CALL(GetGUI()->getDevice()->StretchRect(m_pRenderSurface, NULL, pNewSurface, NULL, D3DTEXF_NONE));
pNewSurface->Release();
IGXSurface *pNewSurface = m_txFinal->getAPItexture()->getMipmap();
GetGUI()->getDevice()->downsampleColorTarget(m_pRenderSurface, pNewSurface);
mem_release(pNewSurface);
/*if(GetAsyncKeyState('K'))
{
......@@ -149,56 +162,69 @@ namespace gui
//CTextureManager::bindTexture(def_w);
SMMATRIX mi = SMMatrixIdentity();
GetGUI()->getDevice()->SetTransform(D3DTS_WORLD, reinterpret_cast<D3DMATRIX*>(&mi));
SMMATRIX mOldView, mOldProj;
GetGUI()->getDevice()->GetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&mOldView));
GetGUI()->getDevice()->GetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DMATRIX*>(&mOldProj));
GetGUI()->getDevice()->SetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&mi));
GetGUI()->getDevice()->SetVertexShader(NULL);
GetGUI()->getDevice()->SetPixelShader(NULL);
GetGUI()->setTransformWorld(mi);
// GetGUI()->getDevice()->SetTransform(D3DTS_WORLD, reinterpret_cast<D3DMATRIX*>(&mi));
SMMATRIX mOldViewProj/*, mOldProj*/;
mOldViewProj = GetGUI()->getTransformViewProj();
// GetGUI()->getDevice()->GetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&mOldView));
// GetGUI()->getDevice()->GetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DMATRIX*>(&mOldProj));
// GetGUI()->getDevice()->SetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&mi));
SMMATRIX m(
2.0f / (float)m_iWidth, 0.0f, 0.0f, 0.0f,
0.0f, -2.0f / (float)m_iHeight, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
-1.0f, 1.0f, 0.5f, 1.0f);
m = SMMatrixTranslation(-0.5f, -0.5f, 0.0f) * m;
GetGUI()->getDevice()->SetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DMATRIX*>(&m));
// GetGUI()->getDevice()->SetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DMATRIX*>(&m));
GetGUI()->setTransformViewProj(mi * m);
struct point
/* struct point
{
float x;
float y;
float z;
float tx;
float ty;
};
};*/
point a[6] = {
/* point a[6] = {
{0, 0, 0, 0.0f, 0.0f},
{m_iWidth, 0, 0, 1.0f, 0.0f},
{0, m_iHeight, 0, 0.0f, 1.0f},
{0, m_iHeight, 0, 0.0f, 1.0f},
{m_iWidth, 0, 0, 1.0f, 0.0f},
{m_iWidth, m_iHeight, 0, 1.0f, 1.0f}
};
};*/
static CSHADER def_sh = CTextureManager::loadShader(L"text");
auto shader = GetGUI()->getShaders()->m_baseTexturedColored;
SGCore_ShaderBind(shader.m_idShaderKit);
// static CSHADER def_sh = CTextureManager::loadShader(L"text");
//GetGUI()->getDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
//GetGUI()->getDevice()->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
//GetGUI()->getDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
GetGUI()->getDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_TEX1);
CTextureManager::bindShader(def_sh);
DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(1.0f, 1.0f, 1.0f, 1.0f), 1));
DX_CALL(GetGUI()->getDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &a, sizeof(point)));
// GetGUI()->getDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_TEX1);
// CTextureManager::bindShader(def_sh);
GetGUI()->getDevice()->setRenderBuffer(m_pRenderBuffer);
GetGUI()->getDevice()->setIndexBuffer(GetGUI()->getQuadIndexBuffer());
SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, shader.m_idPS, "g_vColor", (float*)&float4_t(1.0f, 1.0f, 1.0f, 1.0f), 1);
// DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(1.0f, 1.0f, 1.0f, 1.0f), 1));
GetGUI()->updateTransformShader();
GetGUI()->getDevice()->drawIndexed(4, 2, 0, 0);
// DX_CALL(GetGUI()->getDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &a, sizeof(point)));
GetGUI()->getDevice()->SetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&mOldView));
GetGUI()->getDevice()->SetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DMATRIX*>(&mOldProj));
// GetGUI()->getDevice()->SetTransform(D3DTS_VIEW, reinterpret_cast<D3DMATRIX*>(&mOldView));
// GetGUI()->getDevice()->SetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DMATRIX*>(&mOldProj));
GetGUI()->setTransformViewProj(mOldViewProj);
}
}
......
......@@ -58,12 +58,15 @@ namespace gui
//dom::IDOMnodeCollection m_cTmpNodes;
IDirect3DSurface9 * m_pRenderSurface;
IGXSurface * m_pRenderSurface;
IGXDepthStencilSurface * m_pDepthStencilSurface;
StringW m_sName;
float m_fParallaxFactor;
IGXVertexBuffer *m_pVertices = NULL;
IGXRenderBuffer *m_pRenderBuffer = NULL;
};
};
......
......@@ -971,7 +971,7 @@ namespace gui
}
}
void CFont::buildString(const StringW & str, UINT decoration, TEXT_ALIGN textAlign, IDirect3DVertexBuffer9 ** ppVertexBuffer, IDirect3DIndexBuffer9 ** ppIndexBuffer, UINT * vertexCount, UINT * indexCount, UINT * lineIndexCount, UINT iAreaWidth, UINT iFirstShift, UINT * pStrWidth)
void CFont::buildString(const StringW & str, UINT decoration, TEXT_ALIGN textAlign, IGXRenderBuffer ** ppVertexBuffer, IGXIndexBuffer ** ppIndexBuffer, UINT * vertexCount, UINT * indexCount, UINT * lineIndexCount, UINT iAreaWidth, UINT iFirstShift, UINT * pStrWidth)
{
UINT iIndexCount;
UINT iVertexCount;
......@@ -1210,21 +1210,12 @@ namespace gui
pVB[i].Pos = (float3)(pVB[i].Pos + offs);
}
}
IGXVertexBuffer *pVertBuffer = GetGUI()->getDevice()->createVertexBuffer(sizeof(vertex)* iVertexCount, GX_BUFFER_USAGE_STATIC | GX_BUFFER_WRITEONLY, pVB);
*ppVertexBuffer = GetGUI()->getDevice()->createRenderBuffer(1, &pVertBuffer, GetGUI()->getVertexDeclarations()->m_pXYZTex);
mem_release(pVertBuffer);
VOID * pData;
DX_CALL(GetGUI()->getDevice()->CreateVertexBuffer(sizeof(vertex)* iVertexCount, D3DUSAGE_WRITEONLY, NULL, D3DPOOL_MANAGED, ppVertexBuffer, 0));
if(!FAILED(DX_CALL((*ppVertexBuffer)->Lock(0, sizeof(vertex)* iVertexCount, (void**)&pData, 0))))
{
memcpy(pData, pVB, sizeof(vertex) * iVertexCount);
(*ppVertexBuffer)->Unlock();
}
DX_CALL(GetGUI()->getDevice()->CreateIndexBuffer(sizeof(UINT)* iIndexCount, D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_MANAGED, ppIndexBuffer, 0));
if(!FAILED(DX_CALL((*ppIndexBuffer)->Lock(0, sizeof(UINT)* iIndexCount, (void**)&pData, 0))))
{
memcpy(pData, pIB, sizeof(UINT) * iIndexCount);
(*ppIndexBuffer)->Unlock();
}
*ppIndexBuffer = GetGUI()->getDevice()->createIndexBuffer(sizeof(UINT)* iIndexCount, GX_BUFFER_USAGE_STATIC | GX_BUFFER_WRITEONLY, GXIT_UINT, pIB);
mem_delete_a(pVB);
mem_delete_a(pIB);
......@@ -1280,4 +1271,4 @@ namespace gui
m_pFT = NULL;
}
}
};
\ No newline at end of file
}
......@@ -97,7 +97,7 @@ namespace gui
void getStringMetrics(const StringW & str, UINT * width, UINT * height, UINT * vertexCount, UINT * indexCount, UINT * strCount, char_rects * pcr = NULL);
void buildString(const StringW & str, UINT decoration, TEXT_ALIGN textAlign, IDirect3DVertexBuffer9 ** ppVertexBuffer, IDirect3DIndexBuffer9 ** ppIndexBuffer, UINT * vertexCount, UINT * indexCount, UINT * lineIndexCount, UINT iAreaWidth = 0, UINT iFirstShift = 0, UINT * pStrWidth = NULL);
void buildString(const StringW & str, UINT decoration, TEXT_ALIGN textAlign, IGXRenderBuffer ** ppVertexBuffer, IGXIndexBuffer ** ppIndexBuffer, UINT * vertexCount, UINT * indexCount, UINT * lineIndexCount, UINT iAreaWidth = 0, UINT iFirstShift = 0, UINT * pStrWidth = NULL);
protected:
struct SXFheader
......@@ -191,6 +191,7 @@ namespace gui
static FT_Library requestFT();
static void release();
protected:
static AssotiativeArray<StringW, CFont> m_mFonts;
......
......@@ -5,11 +5,13 @@
#include <graphix/graphix.h>
#include <gcore/sxgcore.h>
#ifndef SX_STATIC_BUILD
#if defined(_DEBUG)
# pragma comment(lib, "sxgcore_d.lib")
#else
# pragma comment(lib, "sxgcore.lib")
#endif
#endif
#if defined(_WINDOWS)
#pragma warning(disable:4244)
......
......@@ -26,6 +26,7 @@ namespace gui
IRenderBorder::~IRenderBorder()
{
mem_release(m_pIndexBuffer);
mem_release(m_pRenderBuffer);
mem_release(m_pVertexBuffer);
}
......@@ -99,20 +100,17 @@ namespace gui
return;
}
static CPITexture texWhite = NULL;
static CSHADER shText = NULL;
if(!shText)
{
shText = CTextureManager::loadShader(L"text");
}
if(!texWhite)
{
texWhite = CTextureManager::getTexture(TEX_WHITE);
}
GetGUI()->getDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
// GetGUI()->getDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
CTextureManager::bindTexture(texWhite);
CTextureManager::bindShader(shText);
// CTextureManager::bindShader(shText);
auto shader = GetGUI()->getShaders()->m_baseColored;
SGCore_ShaderBind(shader.m_idShaderKit);
bool need = false;
for(UINT i = 0; i < 4; i++)
{
......@@ -123,9 +121,9 @@ namespace gui
}
if(need)
{
GetGUI()->getDevice()->SetFVF(D3DFVF_XYZ);
DX_CALL(GetGUI()->getDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(float3_t)));
DX_CALL(GetGUI()->getDevice()->SetIndices(m_pIndexBuffer));
// GetGUI()->getDevice()->SetFVF(D3DFVF_XYZ);
GetGUI()->getDevice()->setRenderBuffer(m_pRenderBuffer);
GetGUI()->getDevice()->setIndexBuffer(m_pIndexBuffer);
}
// UINT iVC = 0;
......@@ -134,8 +132,10 @@ namespace gui
{
if(m_iWidth[i] != 0)
{
DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&m_pColor[i], 1));
DX_CALL(GetGUI()->getDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, m_iVertexStart[i], 0, m_iVertexCount[i], m_iIndexStart[i], m_iIndexCount[i] / 3));
SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, shader.m_idPS, "g_vColor", (float*)&m_pColor[i], 1);
// DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&m_pColor[i], 1));
// DX_CALL(GetGUI()->getDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, m_iVertexStart[i], 0, m_iVertexCount[i], m_iIndexStart[i], m_iIndexCount[i] / 3));
GetGUI()->getDevice()->drawIndexed(m_iVertexCount[i], m_iIndexCount[i] / 3, m_iIndexStart[i], m_iVertexStart[i]);
}
// iVC += m_iVertexCount[i];
// iIC += m_iIndexCount[i];
......@@ -145,16 +145,20 @@ namespace gui
// GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(0.0f, 1.0f, 0.0f, 0.4f), 1);
// GetGUI()->getDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, iVC, iIC, m_iFillIndexCount / 3);
}
DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(0.0f, 0.0f, 0.0f, 0.0f), 1));
SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, shader.m_idPS, "g_vColor", (float*)&float4_t(0.0f, 0.0f, 0.0f, 0.0f), 1);
// DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(0.0f, 0.0f, 0.0f, 0.0f), 1));
}
void IRenderBorder::renderInnerFill()
{
GetGUI()->getDevice()->SetFVF(D3DFVF_XYZ);
DX_CALL(GetGUI()->getDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(float3_t)));
DX_CALL(GetGUI()->getDevice()->SetIndices(m_pIndexBuffer));
// GetGUI()->getDevice()->SetFVF(D3DFVF_XYZ);
GetGUI()->getDevice()->setRenderBuffer(m_pRenderBuffer);
GetGUI()->getDevice()->setIndexBuffer(m_pIndexBuffer);
static CSHADER shText = CTextureManager::loadShader(L"text");
auto shader = GetGUI()->getShaders()->m_baseColored;
SGCore_ShaderBind(shader.m_idShaderKit);
// static CSHADER shText = CTextureManager::loadShader(L"text");
UINT iVC = 0;
UINT iIC = 0;
......@@ -164,15 +168,18 @@ namespace gui
iIC += m_iIndexCount[i];
}
CTextureManager::bindShader(shText);
DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(1.0f, 1.0f, 1.0f, 1.0f), 1));
DX_CALL(GetGUI()->getDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, iVC, iIC, m_iFillIndexCount / 3));
// CTextureManager::bindShader(shText);
SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, shader.m_idPS, "g_vColor", (float*)&float4_t(1.0f, 1.0f, 1.0f, 1.0f), 1);
// DX_CALL(GetGUI()->getDevice()->SetPixelShaderConstantF(0, (float*)&float4_t(1.0f, 1.0f, 1.0f, 1.0f), 1));
// DX_CALL(GetGUI()->getDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, iVC, iIC, m_iFillIndexCount / 3));
GetGUI()->getDevice()->drawIndexed(iVC, m_iFillIndexCount / 3, iIC, 0);
}
void IRenderBorder::build()
{
mem_release(m_pIndexBuffer);
mem_release(m_pVertexBuffer);
mem_release(m_pRenderBuffer);
float w = m_iInnerWidth;
float h = m_iInnerHeight;
......@@ -381,8 +388,8 @@ namespace gui
UINT iCV = 0;
UINT iCI = 0;
VOID * pData;
DX_CALL(GetGUI()->getDevice()->CreateVertexBuffer(sizeof(float3_t)* iVertexCount, NULL, NULL, D3DPOOL_MANAGED, &m_pVertexBuffer, 0));
if(!FAILED(DX_CALL(m_pVertexBuffer->Lock(0, sizeof(float3_t)* iVertexCount, (void**)&pData, 0))))
m_pVertexBuffer = GetGUI()->getDevice()->createVertexBuffer(sizeof(float3_t)* iVertexCount, GX_BUFFER_USAGE_STATIC | GX_BUFFER_WRITEONLY);
if(m_pVertexBuffer->lock((void**)&pData, GXBL_WRITE))
{
memcpy((float3_t*)pData + iCV, t->vb[0], sizeof(float3_t) * t->iVC[0]);
iCV += t->iVC[0];
......@@ -393,11 +400,13 @@ namespace gui
memcpy((float3_t*)pData + iCV, l->vb[0], sizeof(float3_t) * l->iVC[0]);
iCV += l->iVC[0];
m_pVertexBuffer->Unlock();
m_pVertexBuffer->unlock();
}
DX_CALL(GetGUI()->getDevice()->CreateIndexBuffer(sizeof(UINT)* iIndexCount, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &m_pIndexBuffer, 0));
if(!FAILED(DX_CALL(m_pIndexBuffer->Lock(0, sizeof(UINT)* iIndexCount, (void**)&pData, 0))))
m_pRenderBuffer = GetGUI()->getDevice()->createRenderBuffer(1, &m_pVertexBuffer, GetGUI()->getVertexDeclarations()->m_pXYZ);
m_pIndexBuffer = GetGUI()->getDevice()->createIndexBuffer(sizeof(UINT)* iIndexCount, GX_BUFFER_USAGE_STATIC | GX_BUFFER_WRITEONLY, GXIT_UINT);
if(m_pIndexBuffer->lock((void**)&pData, GXBL_WRITE))
{
memcpy((UINT*)pData + iCI, t->ib[0], sizeof(UINT) * t->iIC[0]);
iCI += t->iIC[0];
......@@ -408,7 +417,7 @@ namespace gui
memcpy((UINT*)pData + iCI, l->ib[0], sizeof(UINT) * l->iIC[0]);
iCI += l->iIC[0];
memcpy((UINT*)pData + iCI, pIndices, sizeof(UINT) * IndexCount);
m_pIndexBuffer->Unlock();
m_pIndexBuffer->unlock();
}
}
......
......@@ -65,8 +65,9 @@ namespace gui
UINT m_iRadius[4];
CORNER_METHOD m_method[4];
IDirect3DIndexBuffer9 * m_pIndexBuffer;
IDirect3DVertexBuffer9 * m_pVertexBuffer;
IGXIndexBuffer * m_pIndexBuffer;
IGXVertexBuffer * m_pVertexBuffer;
IGXRenderBuffer *m_pRenderBuffer = NULL;
UINT m_iVertexCount[4];
UINT m_iVertexStart[4];
......
This diff is collapsed.
......@@ -46,8 +46,9 @@ namespace gui
{
}
StringW m_szStr;
IDirect3DVertexBuffer9 * m_pVertexBuffer;
IDirect3DIndexBuffer9 * m_pIndexBuffer;
// IGXVertexBuffer * m_pVertexBuffer;
IGXRenderBuffer *m_pRenderBuffer;
IGXIndexBuffer * m_pIndexBuffer;
UINT m_iVertexCount;
UINT m_iIndexBaseCount;
UINT m_iIndexAddCount;
......@@ -226,7 +227,7 @@ namespace gui
bool m_bFreezed;
pointtex m_pVBackground[15];
pointtex m_pVBackground[16];
int m_iTCBackground;
void updateBorder();
......@@ -294,6 +295,9 @@ namespace gui
UINT m_iTextIdx;
Array<Array<CRenderElement*>> m_mTextRELs;
GXSAMPLER_DESC m_samplerDesc;
IGXSamplerState *m_pSamplerState = NULL;
};
class IRenderBlock: public IRenderFrame
......
This diff is collapsed.
......@@ -21,6 +21,8 @@ namespace gui
class CGUI: public IGUI
{
public:
SX_ALIGNED_OP_MEM2();
CGUI(IGXContext * pDev, const char * szResPath, HWND hWnd);
BOOL putMessage(UINT msg, WPARAM wParam, LPARAM lParam);
......@@ -71,7 +73,94 @@ namespace gui
void destroyDesktop(IDesktop * dp);
void execCallback(const StringW cmd, IEvent * ev);
struct shader_s
{
ID m_idVS = -1;
ID m_idPS = -1;
ID m_idShaderKit = -1;
};
struct shaders_s
{
shader_s m_baseTexturedColored;
shader_s m_baseTexturedTextransformColored;
shader_s m_baseColored;
};
const shaders_s *getShaders()
{
return(&m_shaders);
}
struct dsstate_s
{
IGXDepthStencilState *m_pDefault;
IGXDepthStencilState *m_pStencilIncr;
IGXDepthStencilState *m_pStencilDecr;
IGXDepthStencilState *m_pStencilKeep;
};
const dsstate_s *getDepthStencilStates()
{
return(&m_depthStencilStates);
}
struct bstate_s
{
IGXBlendState *m_pDefault;
IGXBlendState *m_pDesktop;
IGXBlendState *m_pNoColorWrite;
};