Beatmup
rendering_programs.cpp File Reference
#include "rendering_programs.h"
#include "gpu/pipeline.h"
#include "../gpu/bgl.h"

Go to the source code of this file.

Classes

class  Beatmup::GL::RenderingPrograms::Backend
 

Enumerations

enum  TextureUnits { IMAGE = 0 , MASK , MASK_LOOKUP }
 

Variables

static const char * VERTEX_SHADER_BLEND
 
static const char * VERTEX_SHADER_BLENDMASK
 
static const char * FRAGMENT_SHADER_BLEND
 
static const char * FRAGMENT_SHADER_BLENDMASK
 
static const char * FRAGMENT_SHADER_BLENDMASK_8BIT
 
static const char * FRAGMENT_SHADER_BLENDSHAPE
 

Enumeration Type Documentation

◆ TextureUnits

Enumerator
IMAGE 
MASK 
MASK_LOOKUP 

Definition at line 33 of file rendering_programs.cpp.

33  {
34  IMAGE = 0,
35  MASK,
37 };
@ MASK_LOOKUP

Variable Documentation

◆ VERTEX_SHADER_BLEND

const char* VERTEX_SHADER_BLEND
static
Initial value:
attribute vec2 inVertex;
attribute vec2 inTexCoord;
uniform mat3 modelview;
uniform bool flipVertically;
varying vec2 texCoord;
void main()
{
gl_Position = vec4(modelview * vec3(inVertex, 1), 1);
gl_Position.x = gl_Position.x * 2.0 - 1.0;
if (flipVertically)
gl_Position.y = gl_Position.y * 2.0 - 1.0;
else
gl_Position.y = 1.0 - gl_Position.y * 2.0;
texCoord = inTexCoord;
}
)
#define BEATMUP_SHADER_CODE(...)
Definition: program.h:26

Definition at line 41 of file rendering_programs.cpp.

◆ VERTEX_SHADER_BLENDMASK

const char * VERTEX_SHADER_BLENDMASK
static
Initial value:
attribute vec2 inVertex;
attribute vec2 inTexCoord;
uniform mat3 modelview;
uniform bool flipVertically;
uniform mat3 maskMapping;
uniform mat3 invImgMapping;
varying vec2 texCoord;
varying vec2 maskCoord;
void main()
{
gl_Position = vec4(modelview * maskMapping * vec3(inVertex, 1), 1);
gl_Position.x = gl_Position.x * 2.0 - 1.0;
if (flipVertically)
gl_Position.y = gl_Position.y * 2.0 - 1.0;
else
gl_Position.y = 1.0 - gl_Position.y * 2.0;
texCoord = (invImgMapping * vec3(inVertex, 1)).xy;
maskCoord = inTexCoord;
}
)
jlong jintArray xy

Definition at line 60 of file rendering_programs.cpp.

◆ FRAGMENT_SHADER_BLEND

const char * FRAGMENT_SHADER_BLEND
static
Initial value:
uniform beatmupSampler image;
uniform mediump vec4 modulationColor;
varying mediump vec2 texCoord;
void main() {
gl_FragColor = beatmupTexture(image, texCoord.xy).rgba * modulationColor;
}
)

Definition at line 83 of file rendering_programs.cpp.

◆ FRAGMENT_SHADER_BLENDMASK

const char * FRAGMENT_SHADER_BLENDMASK
static

Definition at line 93 of file rendering_programs.cpp.

◆ FRAGMENT_SHADER_BLENDMASK_8BIT

const char * FRAGMENT_SHADER_BLENDMASK_8BIT
static
Initial value:
uniform beatmupSampler image;
uniform highp sampler2D mask;
uniform mediump vec4 modulationColor;
uniform mediump vec4 bgColor;
varying mediump vec2 texCoord;
varying highp vec2 maskCoord;
)
void main() {
highp float a = 0.0;
if (texCoord.x >= 0.0 && texCoord.y >= 0.0 && texCoord.x < 1.0 && texCoord.y < 1.0)
a = texture2D(mask, maskCoord).r;
gl_FragColor = mix(bgColor, beatmupTexture(image, texCoord.xy).rgba, a) * modulationColor;
}
)
jobject jlong jint jint jint r
jobject jlong jint jint jint jint jint jint a

Definition at line 133 of file rendering_programs.cpp.

◆ FRAGMENT_SHADER_BLENDSHAPE

const char * FRAGMENT_SHADER_BLENDSHAPE
static
Initial value:
uniform beatmupSampler image;
varying mediump vec2 texCoord;
varying mediump vec2 maskCoord;
uniform highp vec2 borderProfile;
uniform highp float slope;
uniform highp float border;
uniform highp float cornerRadius;
uniform mediump vec4 modulationColor;
uniform mediump vec4 bgColor;
void main() {
highp vec2 cornerCoords = vec2(cornerRadius - min(maskCoord.x, 1.0 - maskCoord.x) * borderProfile.x, cornerRadius - min(maskCoord.y, 1.0 - maskCoord.y) * borderProfile.y);
highp float r;
if (cornerRadius > 0.0 && cornerCoords.x > 0.0 && cornerCoords.y > 0.0)
r = length(cornerCoords / cornerRadius) * cornerRadius;
else
r = max(cornerCoords.x, cornerCoords.y);
if (texCoord.x < 0.0 || texCoord.y < 0.0 || texCoord.x >= 1.0 || texCoord.y >= 1.0)
gl_FragColor = bgColor;
else
gl_FragColor = beatmupTexture(image, texCoord.xy).rgba;
gl_FragColor = gl_FragColor * clamp((cornerRadius - border - r) / (slope + 0.00098), 0.0, 1.0) * modulationColor;
}
)
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Definition: geometry.h:724
CustomPoint< numeric > max(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Definition: geometry.h:728

Definition at line 162 of file rendering_programs.cpp.