mirror of https://github.com/raysan5/raylib
Review formatting
This commit is contained in:
parent
cf47fbb20b
commit
3caa424ad4
|
@ -1377,7 +1377,7 @@ int InitPlatform(void)
|
|||
|
||||
if (CORE.Window.fullscreen)
|
||||
{
|
||||
// remember center for switchinging from fullscreen to window
|
||||
// Remember center for switchinging from fullscreen to window
|
||||
if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width))
|
||||
{
|
||||
// If screen width/height equal to the display, we can't calculate the window pos for toggling full-screened/windowed.
|
||||
|
|
|
@ -512,7 +512,7 @@ void InitAudioDevice(void)
|
|||
}
|
||||
|
||||
TRACELOG(LOG_INFO, "AUDIO: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, " > Backend: miniaudio / %s", ma_get_backend_name(AUDIO.System.context.backend));
|
||||
TRACELOG(LOG_INFO, " > Backend: miniaudio | %s", ma_get_backend_name(AUDIO.System.context.backend));
|
||||
TRACELOG(LOG_INFO, " > Format: %s -> %s", ma_get_format_name(AUDIO.System.device.playback.format), ma_get_format_name(AUDIO.System.device.playback.internalFormat));
|
||||
TRACELOG(LOG_INFO, " > Channels: %d -> %d", AUDIO.System.device.playback.channels, AUDIO.System.device.playback.internalChannels);
|
||||
TRACELOG(LOG_INFO, " > Sample rate: %d -> %d", AUDIO.System.device.sampleRate, AUDIO.System.device.playback.internalSampleRate);
|
||||
|
|
100
src/rmodels.c
100
src/rmodels.c
|
@ -706,7 +706,7 @@ void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int slices, int
|
|||
Vector3 capCenter = endPos;
|
||||
|
||||
float baseSliceAngle = (2.0f*PI)/slices;
|
||||
float baseRingAngle = PI * 0.5f / rings;
|
||||
float baseRingAngle = PI*0.5f/rings;
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
@ -725,34 +725,34 @@ void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int slices, int
|
|||
// as we iterate through the rings they must get smaller by the cos(angle(i))
|
||||
|
||||
// compute the four vertices
|
||||
float ringSin1 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringCos1 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringSin1 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 0 ));
|
||||
float ringCos1 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 0 ));
|
||||
Vector3 w1 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 0 ))*b0.x + ringSin1*b1.x + ringCos1*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 0 ))*b0.y + ringSin1*b1.y + ringCos1*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 0 ))*b0.z + ringSin1*b1.z + ringCos1*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 0 ))*b0.x + ringSin1*b1.x + ringCos1*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 0 ))*b0.y + ringSin1*b1.y + ringCos1*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 0 ))*b0.z + ringSin1*b1.z + ringCos1*b2.z)*radius
|
||||
};
|
||||
float ringSin2 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringCos2 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringSin2 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 0 ));
|
||||
float ringCos2 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 0 ));
|
||||
Vector3 w2 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 0 ))*b0.x + ringSin2*b1.x + ringCos2*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 0 ))*b0.y + ringSin2*b1.y + ringCos2*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 0 ))*b0.z + ringSin2*b1.z + ringCos2*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 0 ))*b0.x + ringSin2*b1.x + ringCos2*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 0 ))*b0.y + ringSin2*b1.y + ringCos2*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 0 ))*b0.z + ringSin2*b1.z + ringCos2*b2.z)*radius
|
||||
};
|
||||
|
||||
float ringSin3 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringCos3 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringSin3 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 1 ));
|
||||
float ringCos3 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 1 ));
|
||||
Vector3 w3 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 1 ))*b0.x + ringSin3*b1.x + ringCos3*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 1 ))*b0.y + ringSin3*b1.y + ringCos3*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 1 ))*b0.z + ringSin3*b1.z + ringCos3*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 1 ))*b0.x + ringSin3*b1.x + ringCos3*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 1 ))*b0.y + ringSin3*b1.y + ringCos3*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 1 ))*b0.z + ringSin3*b1.z + ringCos3*b2.z)*radius
|
||||
};
|
||||
float ringSin4 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringCos4 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringSin4 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 1 ));
|
||||
float ringCos4 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 1 ));
|
||||
Vector3 w4 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 1 ))*b0.x + ringSin4*b1.x + ringCos4*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 1 ))*b0.y + ringSin4*b1.y + ringCos4*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 1 ))*b0.z + ringSin4*b1.z + ringCos4*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 1 ))*b0.x + ringSin4*b1.x + ringCos4*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 1 ))*b0.y + ringSin4*b1.y + ringCos4*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 1 ))*b0.z + ringSin4*b1.z + ringCos4*b2.z)*radius
|
||||
};
|
||||
|
||||
// Make sure cap triangle normals are facing outwards
|
||||
|
@ -849,7 +849,7 @@ void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int slices
|
|||
Vector3 capCenter = endPos;
|
||||
|
||||
float baseSliceAngle = (2.0f*PI)/slices;
|
||||
float baseRingAngle = PI * 0.5f / rings;
|
||||
float baseRingAngle = PI*0.5f/rings;
|
||||
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
@ -868,34 +868,34 @@ void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int slices
|
|||
// as we iterate through the rings they must get smaller by the cos(angle(i))
|
||||
|
||||
// compute the four vertices
|
||||
float ringSin1 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringCos1 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringSin1 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 0 ));
|
||||
float ringCos1 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 0 ));
|
||||
Vector3 w1 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 0 ))*b0.x + ringSin1*b1.x + ringCos1*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 0 ))*b0.y + ringSin1*b1.y + ringCos1*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 0 ))*b0.z + ringSin1*b1.z + ringCos1*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 0 ))*b0.x + ringSin1*b1.x + ringCos1*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 0 ))*b0.y + ringSin1*b1.y + ringCos1*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 0 ))*b0.z + ringSin1*b1.z + ringCos1*b2.z)*radius
|
||||
};
|
||||
float ringSin2 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringCos2 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 0 ));
|
||||
float ringSin2 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 0 ));
|
||||
float ringCos2 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 0 ));
|
||||
Vector3 w2 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 0 ))*b0.x + ringSin2*b1.x + ringCos2*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 0 ))*b0.y + ringSin2*b1.y + ringCos2*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 0 ))*b0.z + ringSin2*b1.z + ringCos2*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 0 ))*b0.x + ringSin2*b1.x + ringCos2*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 0 ))*b0.y + ringSin2*b1.y + ringCos2*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 0 ))*b0.z + ringSin2*b1.z + ringCos2*b2.z)*radius
|
||||
};
|
||||
|
||||
float ringSin3 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringCos3 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringSin3 = sinf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 1 ));
|
||||
float ringCos3 = cosf(baseSliceAngle*(j + 0))*cosf(baseRingAngle*( i + 1 ));
|
||||
Vector3 w3 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 1 ))*b0.x + ringSin3*b1.x + ringCos3*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 1 ))*b0.y + ringSin3*b1.y + ringCos3*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 1 ))*b0.z + ringSin3*b1.z + ringCos3*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 1 ))*b0.x + ringSin3*b1.x + ringCos3*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 1 ))*b0.y + ringSin3*b1.y + ringCos3*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 1 ))*b0.z + ringSin3*b1.z + ringCos3*b2.z)*radius
|
||||
};
|
||||
float ringSin4 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringCos4 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle * ( i + 1 ));
|
||||
float ringSin4 = sinf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 1 ));
|
||||
float ringCos4 = cosf(baseSliceAngle*(j + 1))*cosf(baseRingAngle*( i + 1 ));
|
||||
Vector3 w4 = (Vector3){
|
||||
capCenter.x + (sinf(baseRingAngle * ( i + 1 ))*b0.x + ringSin4*b1.x + ringCos4*b2.x) * radius,
|
||||
capCenter.y + (sinf(baseRingAngle * ( i + 1 ))*b0.y + ringSin4*b1.y + ringCos4*b2.y) * radius,
|
||||
capCenter.z + (sinf(baseRingAngle * ( i + 1 ))*b0.z + ringSin4*b1.z + ringCos4*b2.z) * radius
|
||||
capCenter.x + (sinf(baseRingAngle*( i + 1 ))*b0.x + ringSin4*b1.x + ringCos4*b2.x)*radius,
|
||||
capCenter.y + (sinf(baseRingAngle*( i + 1 ))*b0.y + ringSin4*b1.y + ringCos4*b2.y)*radius,
|
||||
capCenter.z + (sinf(baseRingAngle*( i + 1 ))*b0.z + ringSin4*b1.z + ringCos4*b2.z)*radius
|
||||
};
|
||||
|
||||
rlVertex3f(w1.x, w1.y, w1.z);
|
||||
|
@ -1966,18 +1966,18 @@ static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, i
|
|||
materials[m].maps[MATERIAL_MAP_DIFFUSE].texture = (Texture2D){ rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
||||
|
||||
if (mats[m].diffuse_texname != NULL) materials[m].maps[MATERIAL_MAP_DIFFUSE].texture = LoadTexture(mats[m].diffuse_texname); //char *diffuse_texname; // map_Kd
|
||||
else materials[m].maps[MATERIAL_MAP_DIFFUSE].color = (Color){ (unsigned char)(mats[m].diffuse[0]*255.0f), (unsigned char)(mats[m].diffuse[1]*255.0f), (unsigned char)(mats[m].diffuse[2] * 255.0f), 255 }; //float diffuse[3];
|
||||
else materials[m].maps[MATERIAL_MAP_DIFFUSE].color = (Color){ (unsigned char)(mats[m].diffuse[0]*255.0f), (unsigned char)(mats[m].diffuse[1]*255.0f), (unsigned char)(mats[m].diffuse[2]*255.0f), 255 }; //float diffuse[3];
|
||||
materials[m].maps[MATERIAL_MAP_DIFFUSE].value = 0.0f;
|
||||
|
||||
if (mats[m].specular_texname != NULL) materials[m].maps[MATERIAL_MAP_SPECULAR].texture = LoadTexture(mats[m].specular_texname); //char *specular_texname; // map_Ks
|
||||
materials[m].maps[MATERIAL_MAP_SPECULAR].color = (Color){ (unsigned char)(mats[m].specular[0]*255.0f), (unsigned char)(mats[m].specular[1]*255.0f), (unsigned char)(mats[m].specular[2] * 255.0f), 255 }; //float specular[3];
|
||||
materials[m].maps[MATERIAL_MAP_SPECULAR].color = (Color){ (unsigned char)(mats[m].specular[0]*255.0f), (unsigned char)(mats[m].specular[1]*255.0f), (unsigned char)(mats[m].specular[2]*255.0f), 255 }; //float specular[3];
|
||||
materials[m].maps[MATERIAL_MAP_SPECULAR].value = 0.0f;
|
||||
|
||||
if (mats[m].bump_texname != NULL) materials[m].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture(mats[m].bump_texname); //char *bump_texname; // map_bump, bump
|
||||
materials[m].maps[MATERIAL_MAP_NORMAL].color = WHITE;
|
||||
materials[m].maps[MATERIAL_MAP_NORMAL].value = mats[m].shininess;
|
||||
|
||||
materials[m].maps[MATERIAL_MAP_EMISSION].color = (Color){ (unsigned char)(mats[m].emission[0]*255.0f), (unsigned char)(mats[m].emission[1]*255.0f), (unsigned char)(mats[m].emission[2] * 255.0f), 255 }; //float emission[3];
|
||||
materials[m].maps[MATERIAL_MAP_EMISSION].color = (Color){ (unsigned char)(mats[m].emission[0]*255.0f), (unsigned char)(mats[m].emission[1]*255.0f), (unsigned char)(mats[m].emission[2]*255.0f), 255 }; //float emission[3];
|
||||
|
||||
if (mats[m].displacement_texname != NULL) materials[m].maps[MATERIAL_MAP_HEIGHT].texture = LoadTexture(mats[m].displacement_texname); //char *displacement_texname; // disp
|
||||
}
|
||||
|
@ -2349,7 +2349,7 @@ Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
|||
for (int face = 0; face < numFaces; face++)
|
||||
{
|
||||
// Retrieve lower left corner from face ind
|
||||
int i = face + face / (resX - 1);
|
||||
int i = face + face/(resX - 1);
|
||||
|
||||
triangles[t++] = i + resX;
|
||||
triangles[t++] = i + 1;
|
||||
|
@ -3038,7 +3038,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
|||
Color *pixels = LoadImageColors(cubicmap);
|
||||
|
||||
// NOTE: Max possible number of triangles numCubes*(12 triangles by cube)
|
||||
int maxTriangles = cubicmap.width * cubicmap.height * 12;
|
||||
int maxTriangles = cubicmap.width*cubicmap.height*12;
|
||||
|
||||
int vCounter = 0; // Used to count vertices
|
||||
int tcCounter = 0; // Used to count texcoords
|
||||
|
@ -3588,6 +3588,8 @@ void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector
|
|||
DrawBillboardPro(camera, texture, source, position, up, size, Vector2Zero(), 0.0f, tint);
|
||||
}
|
||||
|
||||
// Draw a billboard with additional parameters
|
||||
// NOTE: Size defines the destination rectangle size, stretching the source texture as required
|
||||
void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint)
|
||||
{
|
||||
// NOTE: Billboard size will maintain source rectangle aspect ratio, size will represent billboard width
|
||||
|
@ -3657,7 +3659,7 @@ void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector
|
|||
rlBegin(RL_QUADS);
|
||||
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
|
||||
|
||||
if (sizeRatio.x * sizeRatio.y >= 0.0f)
|
||||
if (sizeRatio.x*sizeRatio.y >= 0.0f)
|
||||
{
|
||||
// Bottom-left corner for texture and quad
|
||||
rlTexCoord2f((float)source.x/texture.width, (float)source.y/texture.height);
|
||||
|
@ -6310,7 +6312,7 @@ static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCou
|
|||
|
||||
for (unsigned int a = 0; a < m3d->numaction; a++)
|
||||
{
|
||||
animations[a].frameCount = m3d->action[a].durationmsec / M3D_ANIMDELAY;
|
||||
animations[a].frameCount = m3d->action[a].durationmsec/M3D_ANIMDELAY;
|
||||
animations[a].boneCount = m3d->numbone + 1;
|
||||
animations[a].bones = RL_MALLOC((m3d->numbone + 1)*sizeof(BoneInfo));
|
||||
animations[a].framePoses = RL_MALLOC(animations[a].frameCount*sizeof(Transform *));
|
||||
|
|
|
@ -2202,7 +2202,7 @@ bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount)
|
|||
for (int i = 0, j = pointCount - 1; i < pointCount; j = i++)
|
||||
{
|
||||
if ((points[i].y > point.y) != (points[j].y > point.y) &&
|
||||
(point.x < (points[j].x - points[i].x) * (point.y - points[i].y) / (points[j].y - points[i].y) + points[i].x))
|
||||
(point.x < (points[j].x - points[i].x)*(point.y - points[i].y)/(points[j].y - points[i].y) + points[i].x))
|
||||
{
|
||||
inside = !inside;
|
||||
}
|
||||
|
|
|
@ -385,8 +385,8 @@ Image LoadImageSvg(const char *fileNameOrString, int width, int height)
|
|||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
|
||||
if (scaleHeight > scaleWidth) offsetY = (height - svgImage->height*scale) / 2;
|
||||
else offsetX = (width - svgImage->width*scale) / 2;
|
||||
if (scaleHeight > scaleWidth) offsetY = (height - svgImage->height*scale)/2;
|
||||
else offsetX = (width - svgImage->width*scale)/2;
|
||||
|
||||
// Rasterize
|
||||
struct NSVGrasterizer *rast = nsvgCreateRasterizer();
|
||||
|
@ -1018,8 +1018,8 @@ Image GenImageGradientSquare(int width, int height, float density, Color inner,
|
|||
float distY = fabsf(y - centerY);
|
||||
|
||||
// Normalize the distances by the dimensions of the gradient rectangle
|
||||
float normalizedDistX = distX / centerX;
|
||||
float normalizedDistY = distY / centerY;
|
||||
float normalizedDistX = distX/centerX;
|
||||
float normalizedDistY = distY/centerY;
|
||||
|
||||
// Calculate the total normalized Manhattan distance
|
||||
float manhattanDist = fmaxf(normalizedDistX, normalizedDistY);
|
||||
|
@ -1615,7 +1615,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
|||
// Scale image depending on text size
|
||||
if (textSize.y != imSize.y)
|
||||
{
|
||||
float scaleFactor = textSize.y / imSize.y;
|
||||
float scaleFactor = textSize.y/imSize.y;
|
||||
TRACELOG(LOG_INFO, "IMAGE: Text scaled by factor: %f", scaleFactor);
|
||||
|
||||
// Using nearest-neighbor scaling algorithm for default font
|
||||
|
@ -2214,17 +2214,17 @@ void ImageKernelConvolution(Image *image, float* kernel, int kernelSize)
|
|||
|
||||
if (imgindex >= (unsigned int)(image->width*image->height))
|
||||
{
|
||||
temp[kernelWidth * xkabs + ykabs].x = 0.0f;
|
||||
temp[kernelWidth * xkabs + ykabs].y = 0.0f;
|
||||
temp[kernelWidth * xkabs + ykabs].z = 0.0f;
|
||||
temp[kernelWidth * xkabs + ykabs].w = 0.0f;
|
||||
temp[kernelWidth*xkabs + ykabs].x = 0.0f;
|
||||
temp[kernelWidth*xkabs + ykabs].y = 0.0f;
|
||||
temp[kernelWidth*xkabs + ykabs].z = 0.0f;
|
||||
temp[kernelWidth*xkabs + ykabs].w = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp[kernelWidth * xkabs + ykabs].x = ((float)pixels[imgindex].r)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth * xkabs + ykabs].y = ((float)pixels[imgindex].g)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth * xkabs + ykabs].z = ((float)pixels[imgindex].b)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth * xkabs + ykabs].w = ((float)pixels[imgindex].a)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth*xkabs + ykabs].x = ((float)pixels[imgindex].r)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth*xkabs + ykabs].y = ((float)pixels[imgindex].g)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth*xkabs + ykabs].z = ((float)pixels[imgindex].b)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
temp[kernelWidth*xkabs + ykabs].w = ((float)pixels[imgindex].a)/255.0f*kernel[kernelWidth*xkabs + ykabs];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2672,7 +2672,7 @@ void ImageColorTint(Image *image, Color color)
|
|||
float cB = (float)color.b/255;
|
||||
float cA = (float)color.a/255;
|
||||
|
||||
for (int i = 0; i < image->width * image->height; i++)
|
||||
for (int i = 0; i < image->width*image->height; i++)
|
||||
{
|
||||
unsigned char r = (unsigned char)(((float)pixels[i].r/255*cR)*255.0f);
|
||||
unsigned char g = (unsigned char)(((float)pixels[i].g/255*cG)*255.0f);
|
||||
|
@ -2702,7 +2702,7 @@ void ImageColorInvert(Image *image)
|
|||
|
||||
Color *pixels = LoadImageColors(*image);
|
||||
|
||||
for (int i = 0; i < image->width * image->height; i++)
|
||||
for (int i = 0; i < image->width*image->height; i++)
|
||||
{
|
||||
pixels[i].r = 255 - pixels[i].r;
|
||||
pixels[i].g = 255 - pixels[i].g;
|
||||
|
@ -2739,7 +2739,7 @@ void ImageColorContrast(Image *image, float contrast)
|
|||
|
||||
Color *pixels = LoadImageColors(*image);
|
||||
|
||||
for (int i = 0; i < image->width * image->height; i++)
|
||||
for (int i = 0; i < image->width*image->height; i++)
|
||||
{
|
||||
float pR = (float)pixels[i].r/255.0f;
|
||||
pR -= 0.5f;
|
||||
|
@ -2791,7 +2791,7 @@ void ImageColorBrightness(Image *image, int brightness)
|
|||
|
||||
Color *pixels = LoadImageColors(*image);
|
||||
|
||||
for (int i = 0; i < image->width * image->height; i++)
|
||||
for (int i = 0; i < image->width*image->height; i++)
|
||||
{
|
||||
int cR = pixels[i].r + brightness;
|
||||
int cG = pixels[i].g + brightness;
|
||||
|
@ -2828,7 +2828,7 @@ void ImageColorReplace(Image *image, Color color, Color replace)
|
|||
|
||||
Color *pixels = LoadImageColors(*image);
|
||||
|
||||
for (int i = 0; i < image->width * image->height; i++)
|
||||
for (int i = 0; i < image->width*image->height; i++)
|
||||
{
|
||||
if ((pixels[i].r == color.r) &&
|
||||
(pixels[i].g == color.g) &&
|
||||
|
@ -3616,7 +3616,7 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
|
|||
}
|
||||
|
||||
// Repeat the first row data for all other rows
|
||||
int bytesPerRow = bytesPerPixel * (int)rec.width;
|
||||
int bytesPerRow = bytesPerPixel*(int)rec.width;
|
||||
for (int y = 1; y < (int)rec.height; y++)
|
||||
{
|
||||
memcpy(pSrcPixel + (y*dst->width)*bytesPerPixel, pSrcPixel, bytesPerRow);
|
||||
|
|
Loading…
Reference in New Issue