mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
some cleanup
This commit is contained in:
parent
c66f646ae6
commit
b668f7faab
|
@ -504,7 +504,7 @@ void CGraphics_Threaded::QuadsBegin()
|
||||||
dbg_assert(m_Drawing == 0, "called Graphics()->QuadsBegin twice");
|
dbg_assert(m_Drawing == 0, "called Graphics()->QuadsBegin twice");
|
||||||
m_Drawing = DRAWING_QUADS;
|
m_Drawing = DRAWING_QUADS;
|
||||||
|
|
||||||
QuadsSetSubset(0,0,1,1,0);
|
QuadsSetSubset(0,0,1,1,-1);
|
||||||
QuadsSetRotation(0);
|
QuadsSetRotation(0);
|
||||||
SetColor(1,1,1,1);
|
SetColor(1,1,1,1);
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ void CGraphics_Threaded::SetColor4(vec4 TopLeft, vec4 TopRight, vec4 BottomLeft,
|
||||||
SetColorVertex(Array, 4);
|
SetColorVertex(Array, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics_Threaded::QuadsSetSubset(float TlU, float TlV, float BrU, float BrV, int TextureIndex, bool Use3DTexture)
|
void CGraphics_Threaded::QuadsSetSubset(float TlU, float TlV, float BrU, float BrV, int TextureIndex)
|
||||||
{
|
{
|
||||||
dbg_assert(m_Drawing == DRAWING_QUADS, "called Graphics()->QuadsSetSubset without begin");
|
dbg_assert(m_Drawing == DRAWING_QUADS, "called Graphics()->QuadsSetSubset without begin");
|
||||||
|
|
||||||
|
@ -568,12 +568,12 @@ void CGraphics_Threaded::QuadsSetSubset(float TlU, float TlV, float BrU, float B
|
||||||
m_aTexture[3].v = BrV; m_aTexture[2].v = BrV;
|
m_aTexture[3].v = BrV; m_aTexture[2].v = BrV;
|
||||||
|
|
||||||
m_aTexture[0].i = m_aTexture[1].i = m_aTexture[2].i = m_aTexture[3].i = (0.5f + TextureIndex) / 256.0f;
|
m_aTexture[0].i = m_aTexture[1].i = m_aTexture[2].i = m_aTexture[3].i = (0.5f + TextureIndex) / 256.0f;
|
||||||
m_State.m_Dimension = Use3DTexture ? 3 : 2;
|
m_State.m_Dimension = (TextureIndex < 0) ? 2 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics_Threaded::QuadsSetSubsetFree(
|
void CGraphics_Threaded::QuadsSetSubsetFree(
|
||||||
float x0, float y0, float x1, float y1,
|
float x0, float y0, float x1, float y1,
|
||||||
float x2, float y2, float x3, float y3, int TextureIndex, bool Use3DTexture)
|
float x2, float y2, float x3, float y3, int TextureIndex)
|
||||||
{
|
{
|
||||||
m_aTexture[0].u = x0; m_aTexture[0].v = y0;
|
m_aTexture[0].u = x0; m_aTexture[0].v = y0;
|
||||||
m_aTexture[1].u = x1; m_aTexture[1].v = y1;
|
m_aTexture[1].u = x1; m_aTexture[1].v = y1;
|
||||||
|
@ -581,7 +581,7 @@ void CGraphics_Threaded::QuadsSetSubsetFree(
|
||||||
m_aTexture[3].u = x3; m_aTexture[3].v = y3;
|
m_aTexture[3].u = x3; m_aTexture[3].v = y3;
|
||||||
|
|
||||||
m_aTexture[0].i = m_aTexture[1].i = m_aTexture[2].i = m_aTexture[3].i = (0.5f + TextureIndex) / 256.0f;
|
m_aTexture[0].i = m_aTexture[1].i = m_aTexture[2].i = m_aTexture[3].i = (0.5f + TextureIndex) / 256.0f;
|
||||||
m_State.m_Dimension = Use3DTexture ? 3 : 2;
|
m_State.m_Dimension = (TextureIndex < 0) ? 2 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics_Threaded::QuadsDraw(CQuadItem *pArray, int Num)
|
void CGraphics_Threaded::QuadsDraw(CQuadItem *pArray, int Num)
|
||||||
|
|
|
@ -415,10 +415,10 @@ public:
|
||||||
virtual void SetColor(float r, float g, float b, float a);
|
virtual void SetColor(float r, float g, float b, float a);
|
||||||
virtual void SetColor4(vec4 TopLeft, vec4 TopRight, vec4 BottomLeft, vec4 BottomRight);
|
virtual void SetColor4(vec4 TopLeft, vec4 TopRight, vec4 BottomLeft, vec4 BottomRight);
|
||||||
|
|
||||||
virtual void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV, int TextureIndex = 0, bool Use3DTexture = false);
|
virtual void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV, int TextureIndex = -1);
|
||||||
virtual void QuadsSetSubsetFree(
|
virtual void QuadsSetSubsetFree(
|
||||||
float x0, float y0, float x1, float y1,
|
float x0, float y0, float x1, float y1,
|
||||||
float x2, float y2, float x3, float y3, int TextureIndex = 0, bool Use3DTexture = false);
|
float x2, float y2, float x3, float y3, int TextureIndex = -1);
|
||||||
|
|
||||||
virtual void QuadsDraw(CQuadItem *pArray, int Num);
|
virtual void QuadsDraw(CQuadItem *pArray, int Num);
|
||||||
virtual void QuadsDrawTL(const CQuadItem *pArray, int Num);
|
virtual void QuadsDrawTL(const CQuadItem *pArray, int Num);
|
||||||
|
|
|
@ -124,8 +124,8 @@ public:
|
||||||
virtual void QuadsBegin() = 0;
|
virtual void QuadsBegin() = 0;
|
||||||
virtual void QuadsEnd() = 0;
|
virtual void QuadsEnd() = 0;
|
||||||
virtual void QuadsSetRotation(float Angle) = 0;
|
virtual void QuadsSetRotation(float Angle) = 0;
|
||||||
virtual void QuadsSetSubset(float TopLeftY, float TopLeftV, float BottomRightU, float BottomRightV, int TextureIndex = 0, bool Use3DTexture = 0) = 0;
|
virtual void QuadsSetSubset(float TopLeftY, float TopLeftV, float BottomRightU, float BottomRightV, int TextureIndex = -1) = 0;
|
||||||
virtual void QuadsSetSubsetFree(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, int TextureIndex = 0, bool Use3DTexture = 0) = 0;
|
virtual void QuadsSetSubsetFree(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, int TextureIndex = -1) = 0;
|
||||||
|
|
||||||
struct CQuadItem
|
struct CQuadItem
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,10 +258,10 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->BlendNone();
|
Graphics()->BlendNone();
|
||||||
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE,
|
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE,
|
||||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset, true);
|
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||||
Graphics()->BlendNormal();
|
Graphics()->BlendNormal();
|
||||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
||||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset, true);
|
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||||
}
|
}
|
||||||
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
// map render methods (gc_render_map.cpp)
|
// map render methods (gc_render_map.cpp)
|
||||||
static void RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, float Time, float *pResult);
|
static void RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, float Time, float *pResult);
|
||||||
void RenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser);
|
void RenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser);
|
||||||
void RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4 Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset, bool UseArray);
|
void RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4 Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset);
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
void MapscreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY,
|
void MapscreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY,
|
||||||
|
|
|
@ -164,17 +164,10 @@ void CRenderTools::RenderQuads(CQuad *pQuads, int NumQuads, int RenderFlags, ENV
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4 Color, int RenderFlags,
|
void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4 Color, int RenderFlags,
|
||||||
ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset, bool UseArray)
|
ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset)
|
||||||
{
|
{
|
||||||
//Graphics()->TextureSet(img_get(tmap->image));
|
|
||||||
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
|
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
|
||||||
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
|
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
|
||||||
//Graphics()->MapScreen(screen_x0-50, screen_y0-50, screen_x1+50, screen_y1+50);
|
|
||||||
|
|
||||||
// calculate the final pixelsize for the tiles
|
|
||||||
float TilePixelSize = 1024/32.0f;
|
|
||||||
float FinalTileSize = Scale/(ScreenX1-ScreenX0) * Graphics()->ScreenWidth();
|
|
||||||
float FinalTilesetScale = FinalTileSize/TilePixelSize;
|
|
||||||
|
|
||||||
float r=1, g=1, b=1, a=1;
|
float r=1, g=1, b=1, a=1;
|
||||||
if(ColorEnv >= 0)
|
if(ColorEnv >= 0)
|
||||||
|
@ -195,11 +188,6 @@ void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4
|
||||||
int EndY = (int)(ScreenY1/Scale)+1;
|
int EndY = (int)(ScreenY1/Scale)+1;
|
||||||
int EndX = (int)(ScreenX1/Scale)+1;
|
int EndX = (int)(ScreenX1/Scale)+1;
|
||||||
|
|
||||||
// adjust the texture shift according to mipmap level
|
|
||||||
float TexSize = 1024.0f;
|
|
||||||
float Frac = (1.25f/TexSize) * (1/FinalTilesetScale);
|
|
||||||
float Nudge = (0.5f/TexSize) * (1/FinalTilesetScale);
|
|
||||||
|
|
||||||
for(int y = StartY; y < EndY; y++)
|
for(int y = StartY; y < EndY; y++)
|
||||||
for(int x = StartX; x < EndX; x++)
|
for(int x = StartX; x < EndX; x++)
|
||||||
{
|
{
|
||||||
|
@ -250,41 +238,14 @@ void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4
|
||||||
|
|
||||||
if(Render)
|
if(Render)
|
||||||
{
|
{
|
||||||
|
float x0 = 0;
|
||||||
int tx = Index%16;
|
float y0 = 0;
|
||||||
int ty = Index/16;
|
float x1 = 1;
|
||||||
int Px0 = tx*(1024/16);
|
float y1 = 0;
|
||||||
int Py0 = ty*(1024/16);
|
float x2 = 1;
|
||||||
int Px1 = Px0+(1024/16)-1;
|
float y2 = 1;
|
||||||
int Py1 = Py0+(1024/16)-1;
|
float x3 = 0;
|
||||||
/*
|
float y3 = 1;
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
float x0, y0, x1, y1, x2, y2, x3, y3;
|
|
||||||
|
|
||||||
if(UseArray)
|
|
||||||
{
|
|
||||||
x0 = 0;
|
|
||||||
y0 = 0;
|
|
||||||
x1 = 1;
|
|
||||||
y1 = 0;
|
|
||||||
x2 = 1;
|
|
||||||
y2 = 1;
|
|
||||||
x3 = 0;
|
|
||||||
y3 = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x0 = Nudge + Px0/TexSize+Frac;
|
|
||||||
y0 = Nudge + Py0/TexSize+Frac;
|
|
||||||
x1 = Nudge + Px1/TexSize-Frac;
|
|
||||||
y1 = Nudge + Py0/TexSize+Frac;
|
|
||||||
x2 = Nudge + Px1/TexSize-Frac;
|
|
||||||
y2 = Nudge + Py1/TexSize-Frac;
|
|
||||||
x3 = Nudge + Px0/TexSize+Frac;
|
|
||||||
y3 = Nudge + Py1/TexSize-Frac;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Flags&TILEFLAG_VFLIP)
|
if(Flags&TILEFLAG_VFLIP)
|
||||||
{
|
{
|
||||||
|
@ -316,7 +277,7 @@ void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4
|
||||||
y1 = Tmp;
|
y1 = Tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics()->QuadsSetSubsetFree(x0, y0, x1, y1, x2, y2, x3, y3, Index, UseArray);
|
Graphics()->QuadsSetSubsetFree(x0, y0, x1, y1, x2, y2, x3, y3, Index);
|
||||||
IGraphics::CQuadItem QuadItem(x*Scale, y*Scale, Scale, Scale);
|
IGraphics::CQuadItem QuadItem(x*Scale, y*Scale, Scale, Scale);
|
||||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2532,7 +2532,7 @@ void CEditor::ReplaceImage(const char *pFileName, int StorageType, void *pUser)
|
||||||
pImg->m_External = External;
|
pImg->m_External = External;
|
||||||
pEditor->ExtractName(pFileName, pImg->m_aName, sizeof(pImg->m_aName));
|
pEditor->ExtractName(pFileName, pImg->m_aName, sizeof(pImg->m_aName));
|
||||||
pImg->LoadAutoMapper();
|
pImg->LoadAutoMapper();
|
||||||
pImg->m_Texture = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
|
pImg->m_Texture = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_MULTI_DIMENSION);
|
||||||
ImgInfo.m_pData = 0;
|
ImgInfo.m_pData = 0;
|
||||||
pEditor->SortImages();
|
pEditor->SortImages();
|
||||||
for(int i = 0; i < pEditor->m_Map.m_lImages.size(); ++i)
|
for(int i = 0; i < pEditor->m_Map.m_lImages.size(); ++i)
|
||||||
|
@ -2561,7 +2561,7 @@ void CEditor::AddImage(const char *pFileName, int StorageType, void *pUser)
|
||||||
|
|
||||||
CEditorImage *pImg = new CEditorImage(pEditor);
|
CEditorImage *pImg = new CEditorImage(pEditor);
|
||||||
*pImg = ImgInfo;
|
*pImg = ImgInfo;
|
||||||
pImg->m_Texture = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
|
pImg->m_Texture = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_MULTI_DIMENSION);
|
||||||
ImgInfo.m_pData = 0;
|
ImgInfo.m_pData = 0;
|
||||||
pImg->m_External = 1; // external by default
|
pImg->m_External = 1; // external by default
|
||||||
str_copy(pImg->m_aName, aBuf, sizeof(pImg->m_aName));
|
str_copy(pImg->m_aName, aBuf, sizeof(pImg->m_aName));
|
||||||
|
@ -3902,11 +3902,7 @@ void CEditor::Reset(bool CreateDefault)
|
||||||
|
|
||||||
// create default layers
|
// create default layers
|
||||||
if(CreateDefault)
|
if(CreateDefault)
|
||||||
m_Map.CreateDefault(m_EntitiesTexture);
|
m_Map.CreateDefault();
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
}*/
|
|
||||||
|
|
||||||
m_SelectedLayer = 0;
|
m_SelectedLayer = 0;
|
||||||
m_SelectedGroup = 0;
|
m_SelectedGroup = 0;
|
||||||
|
@ -4018,7 +4014,7 @@ void CEditorMap::Clean()
|
||||||
m_Modified = false;
|
m_Modified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditorMap::CreateDefault(IGraphics::CTextureHandle EntitiesTexture)
|
void CEditorMap::CreateDefault()
|
||||||
{
|
{
|
||||||
// add background
|
// add background
|
||||||
CLayerGroup *pGroup = NewGroup();
|
CLayerGroup *pGroup = NewGroup();
|
||||||
|
@ -4064,7 +4060,7 @@ void CEditor::Init()
|
||||||
m_CheckerTexture = Graphics()->LoadTexture("editor/checker.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
m_CheckerTexture = Graphics()->LoadTexture("editor/checker.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||||
m_BackgroundTexture = Graphics()->LoadTexture("editor/background.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
m_BackgroundTexture = Graphics()->LoadTexture("editor/background.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||||
m_CursorTexture = Graphics()->LoadTexture("editor/cursor.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
m_CursorTexture = Graphics()->LoadTexture("editor/cursor.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||||
m_EntitiesTexture = Graphics()->LoadTexture("editor/entities.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
m_EntitiesTexture = Graphics()->LoadTexture("editor/entities.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_MULTI_DIMENSION);
|
||||||
|
|
||||||
m_TilesetPicker.m_pEditor = this;
|
m_TilesetPicker.m_pEditor = this;
|
||||||
m_TilesetPicker.MakePalette();
|
m_TilesetPicker.MakePalette();
|
||||||
|
|
|
@ -359,7 +359,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clean();
|
void Clean();
|
||||||
void CreateDefault(IGraphics::CTextureHandle EntitiesTexture);
|
void CreateDefault();
|
||||||
|
|
||||||
// io
|
// io
|
||||||
int Save(class IStorage *pStorage, const char *pFilename);
|
int Save(class IStorage *pStorage, const char *pFilename);
|
||||||
|
|
|
@ -484,7 +484,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
||||||
if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL))
|
if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL))
|
||||||
{
|
{
|
||||||
*pImg = ImgInfo;
|
*pImg = ImgInfo;
|
||||||
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
|
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_MULTI_DIMENSION);
|
||||||
ImgInfo.m_pData = 0;
|
ImgInfo.m_pData = 0;
|
||||||
pImg->m_External = 1;
|
pImg->m_External = 1;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
||||||
void *pData = DataFile.GetData(pItem->m_ImageData);
|
void *pData = DataFile.GetData(pItem->m_ImageData);
|
||||||
pImg->m_pData = mem_alloc(pImg->m_Width*pImg->m_Height*PixelSize, 1);
|
pImg->m_pData = mem_alloc(pImg->m_Width*pImg->m_Height*PixelSize, 1);
|
||||||
mem_copy(pImg->m_pData, pData, pImg->m_Width*pImg->m_Height*PixelSize);
|
mem_copy(pImg->m_pData, pData, pImg->m_Width*pImg->m_Height*PixelSize);
|
||||||
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(pImg->m_Width, pImg->m_Height, pImg->m_Format, pImg->m_pData, CImageInfo::FORMAT_AUTO, 0);
|
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(pImg->m_Width, pImg->m_Height, pImg->m_Format, pImg->m_pData, CImageInfo::FORMAT_AUTO, IGraphics::TEXLOAD_MULTI_DIMENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy image name
|
// copy image name
|
||||||
|
|
|
@ -68,10 +68,10 @@ void CLayerTiles::Render()
|
||||||
vec4 Color = vec4(m_Color.r/255.0f, m_Color.g/255.0f, m_Color.b/255.0f, m_Color.a/255.0f);
|
vec4 Color = vec4(m_Color.r/255.0f, m_Color.g/255.0f, m_Color.b/255.0f, m_Color.a/255.0f);
|
||||||
Graphics()->BlendNone();
|
Graphics()->BlendNone();
|
||||||
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE,
|
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE,
|
||||||
m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset, false);
|
m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
|
||||||
Graphics()->BlendNormal();
|
Graphics()->BlendNormal();
|
||||||
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_TRANSPARENT,
|
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_TRANSPARENT,
|
||||||
m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset, false);
|
m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLayerTiles::ConvertX(float x) const { return (int)(x/32.0f); }
|
int CLayerTiles::ConvertX(float x) const { return (int)(x/32.0f); }
|
||||||
|
|
Loading…
Reference in a new issue