mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
introduce startup options
* startup options with -help and -version * many startup options for graphics
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "coordsbuffer.h"
|
||||
#include "graphics.h"
|
||||
|
||||
CoordsBuffer::CoordsBuffer()
|
||||
{
|
||||
@@ -86,6 +87,9 @@ void CoordsBuffer::addRepeatedRects(const Rect& dest, const Rect& src)
|
||||
|
||||
void CoordsBuffer::enableHardwareCaching(HardwareBuffer::UsagePattern usagePattern)
|
||||
{
|
||||
if(!g_graphics.canUseHardwareBuffers())
|
||||
return;
|
||||
|
||||
#ifndef OPENGL_ES2
|
||||
if(!GL_ARB_vertex_buffer_object)
|
||||
return;
|
||||
|
@@ -62,6 +62,23 @@ void Graphics::terminate()
|
||||
m_emptyTexture.reset();
|
||||
}
|
||||
|
||||
bool Graphics::parseOption(const std::string& option)
|
||||
{
|
||||
if(option == "-no-fbos")
|
||||
m_useFBO = false;
|
||||
else if(option == "-no-mipmapping")
|
||||
m_generateMipmaps = false;
|
||||
else if(option == "-no-smoothing")
|
||||
m_useBilinearFiltering = false;
|
||||
else if(option == "-realtime-mipmapping")
|
||||
m_generateRealtimeMipmaps = true;
|
||||
else if(option == "-no-hardware-buffering")
|
||||
m_useHardwareBuffers = false;
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Graphics::resize(const Size& size)
|
||||
{
|
||||
setViewportSize(size);
|
||||
|
@@ -31,9 +31,11 @@ class Graphics
|
||||
public:
|
||||
void init();
|
||||
void terminate();
|
||||
bool parseOption(const std::string& option);
|
||||
|
||||
bool canUseFBO() { return m_useFBO; }
|
||||
bool canUseBilinearFiltering() { return m_useBilinearFiltering; }
|
||||
bool canUseHardwareBuffers() { return m_useHardwareBuffers; }
|
||||
bool canGenerateMipmaps() { return m_generateMipmaps; }
|
||||
bool canGenerateHardwareMipmaps() { return m_generateHardwareMipmaps; }
|
||||
bool canGenerateRealtimeMipmaps() { return m_generateRealtimeMipmaps; }
|
||||
@@ -53,6 +55,7 @@ private:
|
||||
TexturePtr m_emptyTexture;
|
||||
|
||||
Boolean<true> m_useFBO;
|
||||
Boolean<true> m_useHardwareBuffers;
|
||||
Boolean<true> m_useBilinearFiltering;
|
||||
Boolean<true> m_generateMipmaps;
|
||||
Boolean<true> m_generateHardwareMipmaps;
|
||||
|
@@ -103,7 +103,9 @@ void Texture::generateMipmaps()
|
||||
generateHardwareMipmaps();
|
||||
else {
|
||||
// fallback to software mipmaps generation, this can be slow
|
||||
generateSoftwareMipmaps(getPixels());
|
||||
//FIXME: disable because mipmaps size needs to be in base of 2,
|
||||
// and the current algorithmn does not support that
|
||||
//generateSoftwareMipmaps(getPixels());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +171,7 @@ void Texture::generateSoftwareMipmaps(std::vector<uint8> inPixels)
|
||||
Size outSize = inSize / 2;
|
||||
std::vector<uint8> outPixels(outSize.area()*4);
|
||||
|
||||
dump << "yeah";
|
||||
int mipmap = 1;
|
||||
while(true) {
|
||||
// this is a simple bilinear filtering algorithm, it combines every 4 pixels in one pixel
|
||||
|
Reference in New Issue
Block a user