Fix no graphics run
This commit is contained in:
@@ -149,7 +149,6 @@ void FontWithFace::createNewGlyphPage()
|
||||
*/
|
||||
void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
assert(gi.glyph_index > 0);
|
||||
assert(gi.font_number < m_face_ttf->getTotalFaces());
|
||||
FT_Face cur_face = m_face_ttf->getFace(gi.font_number);
|
||||
@@ -193,10 +192,10 @@ void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi)
|
||||
const unsigned int image_pitch =
|
||||
4 * texture_size.Width / sizeof(unsigned int);
|
||||
uint8_t* glyph_data = bits.buffer;
|
||||
for (int y = 0; y < bits.rows; y++)
|
||||
for (unsigned int y = 0; y < (unsigned int)bits.rows; y++)
|
||||
{
|
||||
uint8_t* row = glyph_data;
|
||||
for (int x = 0; x < bits.width; x++)
|
||||
for (unsigned int x = 0; x < (unsigned int)bits.width; x++)
|
||||
{
|
||||
image_data.data()[y * image_pitch + x] |=
|
||||
static_cast<uint32_t>(255.0f *
|
||||
@@ -220,6 +219,7 @@ void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi)
|
||||
}
|
||||
|
||||
const unsigned int cur_tex = m_spritebank->getTextureCount() -1;
|
||||
#ifndef SERVER_ONLY
|
||||
video::ITexture* tex = m_spritebank->getTexture(cur_tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->getOpenGLTextureName());
|
||||
unsigned int format = GL_BGRA;
|
||||
@@ -238,6 +238,7 @@ void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi)
|
||||
if (tex->hasMipMaps())
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
#endif
|
||||
|
||||
// Store the rectangle of current glyph
|
||||
gui::SGUISpriteFrame f;
|
||||
@@ -269,7 +270,6 @@ void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi)
|
||||
m_used_width += texture_size.Width;
|
||||
if (m_current_height < texture_size.Height)
|
||||
m_current_height = texture_size.Height;
|
||||
#endif
|
||||
} // insertGlyph
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -176,6 +176,7 @@ video::ITexture* STKTexManager::getUnicolorTexture(const irr::video::SColor &c)
|
||||
// ----------------------------------------------------------------------------
|
||||
core::stringw STKTexManager::reloadTexture(const irr::core::stringw& name)
|
||||
{
|
||||
core::stringw result;
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isTextureCompressionEnabled())
|
||||
return L"Please disable texture compression for reloading textures.";
|
||||
@@ -193,7 +194,6 @@ core::stringw STKTexManager::reloadTexture(const irr::core::stringw& name)
|
||||
return L"All textures reloaded.";
|
||||
}
|
||||
|
||||
core::stringw result;
|
||||
core::stringw list = name;
|
||||
list.make_lower().replace(L'\u005C', L'\u002F');
|
||||
std::vector<std::string> names =
|
||||
@@ -218,6 +218,6 @@ core::stringw STKTexManager::reloadTexture(const irr::core::stringw& name)
|
||||
}
|
||||
if (result.empty())
|
||||
return L"Texture(s) not found!";
|
||||
return result + "reloaded.";
|
||||
#endif // !SERVER_ONLY
|
||||
return result + "reloaded.";
|
||||
} // reloadTexture
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
@@ -78,6 +79,11 @@ STKTexture::~STKTexture()
|
||||
void STKTexture::reload(bool no_upload, uint8_t* preload_data,
|
||||
bool single_channel)
|
||||
{
|
||||
if (ProfileWorld::isNoGraphics())
|
||||
{
|
||||
m_texture_name = 1;
|
||||
return;
|
||||
}
|
||||
#ifndef SERVER_ONLY
|
||||
irr_driver->getDevice()->getLogger()->setLogLevel(ELL_NONE);
|
||||
|
||||
@@ -236,8 +242,8 @@ video::IImage* STKTexture::resizeImage(video::IImage* orig_img,
|
||||
core::dimension2du* new_img_size,
|
||||
core::dimension2du* new_tex_size)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
video::IImage* image = orig_img;
|
||||
#ifndef SERVER_ONLY
|
||||
const core::dimension2du& old_size = image->getDimension();
|
||||
core::dimension2du img_size = old_size;
|
||||
|
||||
@@ -293,8 +299,8 @@ video::IImage* STKTexture::resizeImage(video::IImage* orig_img,
|
||||
*new_img_size = img_size;
|
||||
*new_tex_size = tex_size;
|
||||
}
|
||||
return image;
|
||||
#endif // !SERVER_ONLY
|
||||
return image;
|
||||
} // resizeImage
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -384,8 +390,8 @@ bool STKTexture::loadCompressedTexture(const std::string& file_name)
|
||||
return true;
|
||||
}
|
||||
delete[] data;
|
||||
return false;
|
||||
#endif
|
||||
return false;
|
||||
} // loadCompressedTexture
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -441,9 +447,8 @@ bool STKTexture::hasMipMaps() const
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
return CVS->getGLSLVersion() >= 130;
|
||||
#else
|
||||
return false;
|
||||
#endif // !SERVER_ONLY
|
||||
return false;
|
||||
} // hasMipMaps
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -460,7 +465,6 @@ void* STKTexture::lock(video::E_TEXTURE_LOCK_MODE mode, u32 mipmap_level)
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
|
||||
glBindTexture(GL_TEXTURE_2D, tmp_texture);
|
||||
return pixels;
|
||||
#else
|
||||
return NULL;
|
||||
#endif // !SERVER_ONLY
|
||||
return NULL;
|
||||
} // lock
|
||||
|
||||
Reference in New Issue
Block a user