mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Merge default into minor
--HG-- branch : minor
This commit is contained in:
@@ -242,6 +242,7 @@ void ParticleSystem::initParticle(Particle *p, float t)
|
||||
|
||||
p->position = pos;
|
||||
|
||||
float rand_x, rand_y;
|
||||
switch (areaSpreadDistribution)
|
||||
{
|
||||
case DISTRIBUTION_UNIFORM:
|
||||
@@ -252,6 +253,12 @@ void ParticleSystem::initParticle(Particle *p, float t)
|
||||
p->position.x += (float) rng.randomNormal(areaSpread.getX());
|
||||
p->position.y += (float) rng.randomNormal(areaSpread.getY());
|
||||
break;
|
||||
case DISTRIBUTION_ELLIPSE:
|
||||
rand_x = (float) rng.random(-1, 1);
|
||||
rand_y = (float) rng.random(-1, 1);
|
||||
p->position.x += areaSpread.getX() * (rand_x * sqrt(1 - 0.5f*pow(rand_y, 2)));
|
||||
p->position.y += areaSpread.getY() * (rand_y * sqrt(1 - 0.5f*pow(rand_x, 2)));
|
||||
break;
|
||||
case DISTRIBUTION_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -949,6 +956,7 @@ StringMap<ParticleSystem::AreaSpreadDistribution, ParticleSystem::DISTRIBUTION_M
|
||||
{ "none", DISTRIBUTION_NONE },
|
||||
{ "uniform", DISTRIBUTION_UNIFORM },
|
||||
{ "normal", DISTRIBUTION_NORMAL },
|
||||
{ "ellipse", DISTRIBUTION_ELLIPSE },
|
||||
};
|
||||
|
||||
StringMap<ParticleSystem::AreaSpreadDistribution, ParticleSystem::DISTRIBUTION_MAX_ENUM> ParticleSystem::distributions(ParticleSystem::distributionsEntries, sizeof(ParticleSystem::distributionsEntries));
|
||||
|
||||
@@ -46,13 +46,14 @@ class ParticleSystem : public Drawable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Type of distribution new particles are drawn from: None, uniform, normal.
|
||||
* Type of distribution new particles are drawn from: None, uniform, normal, ellipse.
|
||||
*/
|
||||
enum AreaSpreadDistribution
|
||||
{
|
||||
DISTRIBUTION_NONE,
|
||||
DISTRIBUTION_UNIFORM,
|
||||
DISTRIBUTION_NORMAL,
|
||||
DISTRIBUTION_ELLIPSE,
|
||||
DISTRIBUTION_MAX_ENUM
|
||||
};
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ enum KTXGLInternalFormat
|
||||
{
|
||||
KTX_GL_ETC1_RGB8_OES = 0x8D64,
|
||||
|
||||
// ETC2 and EAC.
|
||||
KTX_GL_COMPRESSED_R11_EAC = 0x9270,
|
||||
KTX_GL_COMPRESSED_SIGNED_R11_EAC = 0x9271,
|
||||
KTX_GL_COMPRESSED_RG11_EAC = 0x9272,
|
||||
@@ -78,17 +79,33 @@ enum KTXGLInternalFormat
|
||||
KTX_GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278,
|
||||
KTX_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279,
|
||||
|
||||
// I don't know if any KTX file contains PVR data, but why not support it.
|
||||
// PVRTC1.
|
||||
KTX_GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00,
|
||||
KTX_GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01,
|
||||
KTX_GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02,
|
||||
KTX_GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03,
|
||||
|
||||
// Same with DXT1/3/5.
|
||||
KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
|
||||
KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2,
|
||||
KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3,
|
||||
// DXT1, DXT3, and DXT5.
|
||||
KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
|
||||
KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2,
|
||||
KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3,
|
||||
KTX_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C,
|
||||
KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E,
|
||||
KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F,
|
||||
|
||||
// BC4 and BC5.
|
||||
KTX_GL_COMPRESSED_RED_RGTC1 = 0x8DBB,
|
||||
KTX_GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC,
|
||||
KTX_GL_COMPRESSED_RG_RGTC2 = 0x8DBD,
|
||||
KTX_GL_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE,
|
||||
|
||||
// BC6 and BC7.
|
||||
KTX_GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C,
|
||||
KTX_GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D,
|
||||
KTX_GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E,
|
||||
KTX_GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F,
|
||||
|
||||
// ASTC.
|
||||
KTX_GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0,
|
||||
KTX_GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1,
|
||||
KTX_GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2,
|
||||
@@ -129,6 +146,8 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
|
||||
{
|
||||
case KTX_GL_ETC1_RGB8_OES:
|
||||
return CompressedImageData::FORMAT_ETC1;
|
||||
|
||||
// EAC and ETC2.
|
||||
case KTX_GL_COMPRESSED_R11_EAC:
|
||||
return CompressedImageData::FORMAT_EAC_R;
|
||||
case KTX_GL_COMPRESSED_SIGNED_R11_EAC:
|
||||
@@ -152,6 +171,8 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
|
||||
case KTX_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
||||
sRGB = true;
|
||||
return CompressedImageData::FORMAT_ETC2_RGBA;
|
||||
|
||||
// PVRTC.
|
||||
case KTX_GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
|
||||
return CompressedImageData::FORMAT_PVR1_RGB4;
|
||||
case KTX_GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
|
||||
@@ -160,12 +181,42 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
|
||||
return CompressedImageData::FORMAT_PVR1_RGBA4;
|
||||
case KTX_GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
|
||||
return CompressedImageData::FORMAT_PVR1_RGBA2;
|
||||
|
||||
// DXT.
|
||||
case KTX_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
sRGB = true;
|
||||
case KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
return CompressedImageData::FORMAT_DXT1;
|
||||
case KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
||||
sRGB = true;
|
||||
case KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
return CompressedImageData::FORMAT_DXT3;
|
||||
case KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
sRGB = true;
|
||||
case KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
return CompressedImageData::FORMAT_DXT5;
|
||||
|
||||
// BC4 and BC5.
|
||||
case KTX_GL_COMPRESSED_RED_RGTC1:
|
||||
return CompressedImageData::FORMAT_BC4;
|
||||
case KTX_GL_COMPRESSED_SIGNED_RED_RGTC1:
|
||||
return CompressedImageData::FORMAT_BC4s;
|
||||
case KTX_GL_COMPRESSED_RG_RGTC2:
|
||||
return CompressedImageData::FORMAT_BC5;
|
||||
case KTX_GL_COMPRESSED_SIGNED_RG_RGTC2:
|
||||
return CompressedImageData::FORMAT_BC5s;
|
||||
|
||||
// BC6 and BC7.
|
||||
case KTX_GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
|
||||
sRGB = true;
|
||||
case KTX_GL_COMPRESSED_RGBA_BPTC_UNORM:
|
||||
return CompressedImageData::FORMAT_BC7;
|
||||
case KTX_GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
|
||||
return CompressedImageData::FORMAT_BC6Hs;
|
||||
case KTX_GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
|
||||
return CompressedImageData::FORMAT_BC6H;
|
||||
|
||||
// ASTC.
|
||||
case KTX_GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
sRGB = true;
|
||||
case KTX_GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
|
||||
@@ -143,6 +143,8 @@ public:
|
||||
virtual void minimize() = 0;
|
||||
virtual void maximize() = 0;
|
||||
|
||||
virtual bool isMaximized() const = 0;
|
||||
|
||||
// default no-op implementation
|
||||
virtual void swapBuffers();
|
||||
|
||||
|
||||
@@ -886,6 +886,11 @@ void Window::maximize()
|
||||
}
|
||||
}
|
||||
|
||||
bool Window::isMaximized() const
|
||||
{
|
||||
return window != nullptr && (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED);
|
||||
}
|
||||
|
||||
void Window::swapBuffers()
|
||||
{
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
@@ -76,6 +76,8 @@ public:
|
||||
void minimize();
|
||||
void maximize();
|
||||
|
||||
bool isMaximized() const;
|
||||
|
||||
void swapBuffers();
|
||||
|
||||
bool hasFocus() const;
|
||||
|
||||
@@ -466,6 +466,12 @@ int w_maximize(lua_State *)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_isMaximized(lua_State *L)
|
||||
{
|
||||
luax_pushboolean(L, instance()->isMaximized());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_showMessageBox(lua_State *L)
|
||||
{
|
||||
Window::MessageBoxData data = {};
|
||||
@@ -567,6 +573,7 @@ static const luaL_Reg functions[] =
|
||||
{ "fromPixels", w_fromPixels },
|
||||
{ "minimize", w_minimize },
|
||||
{ "maximize", w_maximize },
|
||||
{ "isMaximized", w_isMaximized },
|
||||
{ "showMessageBox", w_showMessageBox },
|
||||
{ "requestAttention", w_requestAttention },
|
||||
{ 0, 0 }
|
||||
|
||||
Reference in New Issue
Block a user