DrawTextureNPatchRepeat.
This commit is contained in:
8
API.md
8
API.md
@@ -6125,6 +6125,12 @@ Draws a texture (or part of it) that stretches or shrinks nicely
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> RL.DrawTextureNPatchRepeat( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint )
|
||||||
|
|
||||||
|
Draws a texture (or part of it) that repeats nicely
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Textures - RenderTexture configuration functions
|
## Textures - RenderTexture configuration functions
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -6554,7 +6560,7 @@ Draw a plane XZ
|
|||||||
|
|
||||||
> RL.DrawQuad3DTexture( Texture texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors )
|
> RL.DrawQuad3DTexture( Texture texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors )
|
||||||
|
|
||||||
Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0).
|
Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Reilua means fair in finnish.
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
ReiLua is WIP and some planned raylib functionality is still missing but it already has over 700 functions and should include all functions to make most 2d and 3d games. Current Raylib version 4.5.0.
|
ReiLua is WIP and some planned raylib functionality is still missing but it already has over 800 functions and should include all functions to make most 2D and 3D games. Current Raylib version 5.0.
|
||||||
|
|
||||||
Included submodules.
|
Included submodules.
|
||||||
|
|
||||||
|
|||||||
@@ -3514,6 +3514,16 @@ function RL.DrawTexturePro( texture, source, dest, origin, rotation, tint ) end
|
|||||||
---@return any RL.DrawTextureNPatch
|
---@return any RL.DrawTextureNPatch
|
||||||
function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end
|
function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end
|
||||||
|
|
||||||
|
---Draws a texture (or part of it) that repeats nicely
|
||||||
|
---@param texture any
|
||||||
|
---@param nPatchInfo any
|
||||||
|
---@param dest table
|
||||||
|
---@param origin table
|
||||||
|
---@param rotation number
|
||||||
|
---@param tint table
|
||||||
|
---@return any RL.DrawTextureNPatchRepeat
|
||||||
|
function RL.DrawTextureNPatchRepeat( texture, nPatchInfo, dest, origin, rotation, tint ) end
|
||||||
|
|
||||||
-- Textures - RenderTexture configuration functions
|
-- Textures - RenderTexture configuration functions
|
||||||
|
|
||||||
---Get OpenGL framebuffer object id
|
---Get OpenGL framebuffer object id
|
||||||
@@ -3955,7 +3965,7 @@ function RL.DrawCapsuleWires( startPos, endPos, radius, slices, rings, color )
|
|||||||
---@return any RL.DrawPlane
|
---@return any RL.DrawPlane
|
||||||
function RL.DrawPlane( centerPos, size, color ) end
|
function RL.DrawPlane( centerPos, size, color ) end
|
||||||
|
|
||||||
---Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0).
|
---Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0)
|
||||||
---@param texture any
|
---@param texture any
|
||||||
---@param vertices table
|
---@param vertices table
|
||||||
---@param texCoords table
|
---@param texCoords table
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ KEY CHANGES:
|
|||||||
- ADDED: 2D lightmap example.
|
- ADDED: 2D lightmap example.
|
||||||
- ADDED: RLGL Hello triangle example.
|
- ADDED: RLGL Hello triangle example.
|
||||||
- ADDED: Rest of rlRenderBatch functions.
|
- ADDED: Rest of rlRenderBatch functions.
|
||||||
|
- ADDED: DrawTextureNPatchRepeat.
|
||||||
|
|
||||||
DETAILED CHANGES:
|
DETAILED CHANGES:
|
||||||
- REMOVED: DrawLineBezierQuad, DrawLineBezierCubic.
|
- REMOVED: DrawLineBezierQuad, DrawLineBezierCubic.
|
||||||
@@ -49,6 +50,7 @@ DETAILED CHANGES:
|
|||||||
- ADDED: GetShaderId.
|
- ADDED: GetShaderId.
|
||||||
- FIXED: rlSetVertexAttribute pointer offset.
|
- FIXED: rlSetVertexAttribute pointer offset.
|
||||||
- ADDED: GetImageData.
|
- ADDED: GetImageData.
|
||||||
|
- FIXED: CameraLib. Slow lateral movement.
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Release: ReiLua version 0.6.0 Using Raylib 4.5
|
Release: ReiLua version 0.6.0 Using Raylib 4.5
|
||||||
|
|||||||
1
devnotes
1
devnotes
@@ -28,7 +28,6 @@ Backlog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bugs {
|
Bugs {
|
||||||
* CameraLib. Lateral movement is slower if looking down or up.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Needs Testing {
|
Needs Testing {
|
||||||
|
|||||||
@@ -1,10 +1,19 @@
|
|||||||
local dstRec = { 160.0, 160.0, 8.0, 8.0 };
|
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
|
||||||
local origin = { 0.0, 0.0 }
|
|
||||||
|
|
||||||
-- local ninePatchInfo = { { 0.0, 0.0, 24.0, 24.0 }, 8, 8, 8, 8, NPATCH_NINE_PATCH }
|
Vec2 = require( "vector2" )
|
||||||
local ninePatchInfo = { source = { 0, 0, 24.0, 24.0 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH }
|
Rect = require( "rectangle" )
|
||||||
|
|
||||||
local nPatchTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
|
local dstRec = Rect:new( 100.0, 100.0, 8.0, 8.0 )
|
||||||
|
local origin = Vec2:new( 0.0, 0.0 )
|
||||||
|
local stretched = true
|
||||||
|
|
||||||
|
-- local ninePatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH }
|
||||||
|
-- local nPatchTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
|
||||||
|
|
||||||
|
local ninePatchInfo = { source = { 0, 0, 96, 96 }, left = 32, top = 32, right = 32, bottom = 32, layout = RL.NPATCH_NINE_PATCH }
|
||||||
|
-- local ninePatchInfo = { source = { 0, 0, 96, 96 }, left = 32, top = 32, right = 32, bottom = 32, layout = RL.NPATCH_THREE_PATCH_VERTICAL }
|
||||||
|
-- local ninePatchInfo = { source = { 0, 0, 96, 96 }, left = 32, top = 32, right = 32, bottom = 32, layout = RL.NPATCH_THREE_PATCH_HORIZONTAL }
|
||||||
|
local nPatchTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/nPatch.png" )
|
||||||
|
|
||||||
function RL.init()
|
function RL.init()
|
||||||
RL.SetWindowTitle( "N-Patches" )
|
RL.SetWindowTitle( "N-Patches" )
|
||||||
@@ -12,14 +21,27 @@ function RL.init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function RL.process( delta )
|
function RL.process( delta )
|
||||||
local mousePosition = RL.GetMousePosition();
|
local mousePosition = Vec2:new( RL.GetMousePosition() )
|
||||||
|
|
||||||
-- Resize the n-patch based on mouse position
|
-- Resize the n-patch based on mouse position
|
||||||
dstRec[3] = mousePosition[1] - dstRec[1];
|
dstRec.width = mousePosition.x - dstRec.x;
|
||||||
dstRec[4] = mousePosition[2] - dstRec[2];
|
dstRec.height = mousePosition.y - dstRec.y;
|
||||||
|
|
||||||
|
if RL.IsKeyPressed( RL.KEY_SPACE ) then
|
||||||
|
stretched = not stretched
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function RL.draw()
|
function RL.draw()
|
||||||
RL.ClearBackground( RL.RAYWHITE )
|
RL.ClearBackground( RL.RAYWHITE )
|
||||||
|
local modeText = "Stretched"
|
||||||
|
|
||||||
|
if stretched then
|
||||||
RL.DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, RL.WHITE )
|
RL.DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, RL.WHITE )
|
||||||
|
else
|
||||||
|
RL.DrawTextureNPatchRepeat( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, RL.WHITE )
|
||||||
|
modeText = "Repeat"
|
||||||
|
end
|
||||||
|
|
||||||
|
RL.DrawText( "Press space to toggle mode: "..modeText, { 20, 20 }, 20, RL.BLACK )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ ui_border.png Jussi Viitala CC0
|
|||||||
ui_bgr.png Jussi Viitala CC0
|
ui_bgr.png Jussi Viitala CC0
|
||||||
gradient.png Jussi Viitala CC0
|
gradient.png Jussi Viitala CC0
|
||||||
light.png Jussi Viitala CC0
|
light.png Jussi Viitala CC0
|
||||||
|
nPatch.png Jussi Viitala CC0
|
||||||
check-mark.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
|
check-mark.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
|
||||||
circle.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
|
circle.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
|
||||||
plain-circle.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
|
plain-circle.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
|
||||||
|
|||||||
BIN
examples/resources/images/nPatch.png
Normal file
BIN
examples/resources/images/nPatch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -137,9 +137,9 @@ function Camera3D:process( delta )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if RL.IsKeyDown( self.KEYS.RIGHT ) then
|
if RL.IsKeyDown( self.KEYS.RIGHT ) then
|
||||||
RL.Camera3DMoveRight( self.camera, distance, false )
|
RL.Camera3DMoveRight( self.camera, distance, true )
|
||||||
elseif RL.IsKeyDown( self.KEYS.LEFT ) then
|
elseif RL.IsKeyDown( self.KEYS.LEFT ) then
|
||||||
RL.Camera3DMoveRight( self.camera, -distance, false )
|
RL.Camera3DMoveRight( self.camera, -distance, true )
|
||||||
end
|
end
|
||||||
elseif self.mode == self.MODES.ORBITAL then
|
elseif self.mode == self.MODES.ORBITAL then
|
||||||
RL.Camera3DYaw( self.camera, self.ORBITAL_SPEED * delta, true )
|
RL.Camera3DYaw( self.camera, self.ORBITAL_SPEED * delta, true )
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ int ltexturesDrawTexture( lua_State *L );
|
|||||||
int ltexturesDrawTextureRec( lua_State *L );
|
int ltexturesDrawTextureRec( lua_State *L );
|
||||||
int ltexturesDrawTexturePro( lua_State *L );
|
int ltexturesDrawTexturePro( lua_State *L );
|
||||||
int ltexturesDrawTextureNPatch( lua_State *L );
|
int ltexturesDrawTextureNPatch( lua_State *L );
|
||||||
|
int ltexturesDrawTextureNPatchRepeat( lua_State *L );
|
||||||
/* RenderTexture configuration functions. */
|
/* RenderTexture configuration functions. */
|
||||||
int ltexturesGetRenderTextureId( lua_State *L );
|
int ltexturesGetRenderTextureId( lua_State *L );
|
||||||
int ltexturesGetRenderTextureTexture( lua_State *L );
|
int ltexturesGetRenderTextureTexture( lua_State *L );
|
||||||
|
|||||||
@@ -1559,6 +1559,7 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
|
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
|
||||||
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
|
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
|
||||||
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
|
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
|
||||||
|
assingGlobalFunction( "DrawTextureNPatchRepeat", ltexturesDrawTextureNPatchRepeat );
|
||||||
/* RenderTexture configuration functions. */
|
/* RenderTexture configuration functions. */
|
||||||
assingGlobalFunction( "GetRenderTextureId", ltexturesGetRenderTextureId );
|
assingGlobalFunction( "GetRenderTextureId", ltexturesGetRenderTextureId );
|
||||||
assingGlobalFunction( "GetRenderTextureTexture", ltexturesGetRenderTextureTexture );
|
assingGlobalFunction( "GetRenderTextureTexture", ltexturesGetRenderTextureTexture );
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ int lmodelsDrawPlane( lua_State *L ) {
|
|||||||
/*
|
/*
|
||||||
> RL.DrawQuad3DTexture( Texture texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors )
|
> RL.DrawQuad3DTexture( Texture texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors )
|
||||||
|
|
||||||
Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0).
|
Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0)
|
||||||
*/
|
*/
|
||||||
int lmodelDrawQuad3DTexture( lua_State *L ) {
|
int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||||
Texture *texture = uluaGetTexture( L, 1 );
|
Texture *texture = uluaGetTexture( L, 1 );
|
||||||
|
|||||||
218
src/textures.c
218
src/textures.c
@@ -1517,6 +1517,224 @@ int ltexturesDrawTextureNPatch( lua_State *L ) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> RL.DrawTextureNPatchRepeat( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint )
|
||||||
|
|
||||||
|
Draws a texture (or part of it) that repeats nicely
|
||||||
|
*/
|
||||||
|
inline static void drawNPatchTile( Vector4 src, Vector4 dst, Vector2 texSize ) {
|
||||||
|
rlTexCoord2f( src.x / texSize.x, src.w / texSize.y ); rlVertex2f( dst.x, dst.w ); // Bottom-left corner for texture and quad
|
||||||
|
rlTexCoord2f( src.z / texSize.x, src.w / texSize.y ); rlVertex2f( dst.z, dst.w ); // Bottom-right corner for texture and quad
|
||||||
|
rlTexCoord2f( src.z / texSize.x, src.y / texSize.y ); rlVertex2f( dst.z, dst.y ); // Top-right corner for texture and quad
|
||||||
|
rlTexCoord2f( src.x / texSize.x, src.y / texSize.y ); rlVertex2f( dst.x, dst.y ); // Top-left corner for texture and quad
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static void drawNPatchArea( Vector4 src, Vector4 dst, Vector2 texSize ) {
|
||||||
|
Vector2 tileSize = { src.z - src.x, src.w - src.y };
|
||||||
|
Vector2 areaSize = { dst.z - dst.x, dst.w - dst.y };
|
||||||
|
int width = ceil( areaSize.x / tileSize.x );
|
||||||
|
int height = ceil( areaSize.y / tileSize.y );
|
||||||
|
|
||||||
|
for ( int y = 0; y < height; y++ ) {
|
||||||
|
for ( int x = 0; x < width; x++ ) {
|
||||||
|
Vector2 rTileSize = {
|
||||||
|
fmin( tileSize.x, areaSize.x - x * tileSize.x ),
|
||||||
|
fmin( tileSize.y, areaSize.y - y * tileSize.y )
|
||||||
|
};
|
||||||
|
Vector4 tileSrc = {
|
||||||
|
src.x,
|
||||||
|
src.y,
|
||||||
|
src.x + rTileSize.x,
|
||||||
|
src.y + rTileSize.y
|
||||||
|
};
|
||||||
|
Vector4 tileDst = {
|
||||||
|
dst.x + x * tileSize.x,
|
||||||
|
dst.y + y * tileSize.y,
|
||||||
|
dst.x + x * tileSize.x + rTileSize.x,
|
||||||
|
dst.y + y * tileSize.y + rTileSize.y
|
||||||
|
};
|
||||||
|
drawNPatchTile( tileSrc, tileDst, texSize );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ltexturesDrawTextureNPatchRepeat( lua_State *L ) {
|
||||||
|
Texture *texture = uluaGetTexture( L, 1 );
|
||||||
|
NPatchInfo nPatchInfo = uluaGetNPatchInfo( L, 2 );
|
||||||
|
Rectangle dest = uluaGetRectangle( L, 3 );
|
||||||
|
Vector2 origin = uluaGetVector2( L, 4 );
|
||||||
|
float rotation = luaL_checknumber( L, 5 );
|
||||||
|
Color tint = uluaGetColor( L, 6 );
|
||||||
|
|
||||||
|
if ( texture->id < 0 || dest.width <= 0 || dest.height <= 0 ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Vector2 texSize = { texture->width, texture->height };
|
||||||
|
float leftBorder = (float)nPatchInfo.left;
|
||||||
|
float topBorder = (float)nPatchInfo.top;
|
||||||
|
float rightBorder = (float)nPatchInfo.right;
|
||||||
|
float bottomBorder = (float)nPatchInfo.bottom;
|
||||||
|
bool drawHMiddle = leftBorder + rightBorder <= dest.width;
|
||||||
|
bool drawVMiddle = topBorder + bottomBorder <= dest.height;
|
||||||
|
bool drawCenter = drawHMiddle && drawVMiddle;
|
||||||
|
|
||||||
|
if ( !drawHMiddle ) {
|
||||||
|
leftBorder = ( leftBorder / ( leftBorder + rightBorder ) ) * dest.width;
|
||||||
|
rightBorder = dest.width - leftBorder;
|
||||||
|
}
|
||||||
|
if ( !drawVMiddle ) {
|
||||||
|
topBorder = ( topBorder / ( topBorder + bottomBorder ) ) * dest.height;
|
||||||
|
bottomBorder = dest.height - topBorder;
|
||||||
|
}
|
||||||
|
Vector2 vertA, vertB, vertC, vertD;
|
||||||
|
vertA.x = 0.0f; // outer left
|
||||||
|
vertA.y = 0.0f; // outer top
|
||||||
|
vertB.x = leftBorder; // inner left
|
||||||
|
vertB.y = topBorder; // inner top
|
||||||
|
vertC.x = dest.width - rightBorder; // inner right
|
||||||
|
vertC.y = dest.height - bottomBorder; // inner bottom
|
||||||
|
vertD.x = dest.width; // outer right
|
||||||
|
vertD.y = dest.height; // outer bottom
|
||||||
|
|
||||||
|
Vector2 coordA, coordB, coordC, coordD;
|
||||||
|
coordA.x = nPatchInfo.source.x;
|
||||||
|
coordA.y = nPatchInfo.source.y;
|
||||||
|
coordB.x = nPatchInfo.source.x + leftBorder;
|
||||||
|
coordB.y = nPatchInfo.source.y + topBorder;
|
||||||
|
coordC.x = nPatchInfo.source.x + nPatchInfo.source.width - rightBorder;
|
||||||
|
coordC.y = nPatchInfo.source.y + nPatchInfo.source.height - bottomBorder;
|
||||||
|
coordD.x = nPatchInfo.source.x + nPatchInfo.source.width;
|
||||||
|
coordD.y = nPatchInfo.source.y + nPatchInfo.source.height;
|
||||||
|
|
||||||
|
rlSetTexture( texture->id );
|
||||||
|
|
||||||
|
rlPushMatrix();
|
||||||
|
rlTranslatef( dest.x, dest.y, 0.0f );
|
||||||
|
rlRotatef( rotation, 0.0f, 0.0f, 1.0f );
|
||||||
|
rlTranslatef( -origin.x, -origin.y, 0.0f );
|
||||||
|
|
||||||
|
rlBegin( RL_QUADS );
|
||||||
|
rlColor4ub( tint.r, tint.g, tint.b, tint.a );
|
||||||
|
rlNormal3f( 0.0f, 0.0f, 1.0f ); // Normal vector pointing towards viewer
|
||||||
|
|
||||||
|
switch ( nPatchInfo.layout ) {
|
||||||
|
case NPATCH_NINE_PATCH:
|
||||||
|
if ( drawCenter ) {
|
||||||
|
// MIDDLE-CENTER QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordB.x, coordB.y, coordC.x, coordC.y },
|
||||||
|
(Vector4){ vertB.x, vertB.y, vertC.x, vertC.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ( drawHMiddle ) {
|
||||||
|
// TOP-CENTER QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordB.x, coordA.y, coordC.x, coordB.y },
|
||||||
|
(Vector4){ vertB.x, vertA.y, vertC.x, vertB.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
// BOTTOM-CENTER QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordB.x, coordC.y, coordC.x, coordD.y },
|
||||||
|
(Vector4){ vertB.x, vertC.y, vertC.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ( drawVMiddle ) {
|
||||||
|
// LEFT-CENTER QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordA.x, coordB.y, coordB.x, coordC.y },
|
||||||
|
(Vector4){ vertA.x, vertB.y, vertB.x, vertC.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
// RIGHT-CENTER QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordC.x, coordB.y, coordD.x, coordC.y },
|
||||||
|
(Vector4){ vertC.x, vertB.y, vertD.x, vertC.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// TOP-LEFT QUAD
|
||||||
|
drawNPatchTile(
|
||||||
|
(Vector4){ coordA.x, coordA.y, coordB.x, coordB.y },
|
||||||
|
(Vector4){ vertA.x, vertA.y, vertB.x, vertB.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
// TOP-RIGHT QUAD
|
||||||
|
drawNPatchTile(
|
||||||
|
(Vector4){ coordC.x, coordA.y, coordD.x, coordB.y },
|
||||||
|
(Vector4){ vertC.x, vertA.y, vertD.x, vertB.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
// BOTTOM-LEFT QUAD
|
||||||
|
drawNPatchTile(
|
||||||
|
(Vector4){ coordA.x, coordC.y, coordB.x, coordD.y },
|
||||||
|
(Vector4){ vertA.x, vertC.y, vertB.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
// BOTTOM-RIGHT QUAD
|
||||||
|
drawNPatchTile(
|
||||||
|
(Vector4){ coordC.x, coordC.y, coordD.x, coordD.y },
|
||||||
|
(Vector4){ vertC.x, vertC.y, vertD.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case NPATCH_THREE_PATCH_VERTICAL:
|
||||||
|
// TOP QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordA.x, coordA.y, coordD.x, coordB.y },
|
||||||
|
(Vector4){ vertA.x, vertA.y, vertD.x, vertB.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
if ( drawVMiddle ) {
|
||||||
|
// MIDDLE QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordA.x, coordB.y, coordD.x, coordC.y },
|
||||||
|
(Vector4){ vertA.x, vertB.y, vertD.x, vertC.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// BOTTOM QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordA.x, coordC.y, coordD.x, coordD.y },
|
||||||
|
(Vector4){ vertA.x, vertC.y, vertD.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case NPATCH_THREE_PATCH_HORIZONTAL:
|
||||||
|
// LEFT QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordA.x, coordA.y, coordB.x, coordD.y },
|
||||||
|
(Vector4){ vertA.x, vertA.y, vertB.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
if ( drawHMiddle ) {
|
||||||
|
// MIDDLE QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordB.x, coordA.y, coordC.x, coordD.y },
|
||||||
|
(Vector4){ vertB.x, vertA.y, vertC.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// RIGHT QUAD
|
||||||
|
drawNPatchArea(
|
||||||
|
(Vector4){ coordC.x, coordA.y, coordD.x, coordD.y },
|
||||||
|
(Vector4){ vertC.x, vertA.y, vertD.x, vertD.y },
|
||||||
|
texSize
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rlEnd();
|
||||||
|
rlPopMatrix();
|
||||||
|
rlSetTexture(0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
## Textures - RenderTexture configuration functions
|
## Textures - RenderTexture configuration functions
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user