Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
53e95878
Commit
53e95878
authored
8 years ago
by
SmallJoker
Committed by
est31
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add [resize texture modifier Resizes the texture to the given dimensions.
parent
95446f4b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/lua_api.txt
+7
-0
7 additions, 0 deletions
doc/lua_api.txt
src/client/tile.cpp
+25
-1
25 additions, 1 deletion
src/client/tile.cpp
with
32 additions
and
1 deletion
doc/lua_api.txt
+
7
−
0
View file @
53e95878
...
...
@@ -279,6 +279,13 @@ Example:
[combine:16x32:0,0=default_cobble.png:0,16=default_wood.png
#### `[resize:<w>x<h>`
Resizes the texture to the given dimensions.
Example:
default_sandstone.png^[resize:16x16
#### `[brighten`
Brightens the texture.
...
...
This diff is collapsed.
Click to expand it.
src/client/tile.cpp
+
25
−
1
View file @
53e95878
...
...
@@ -1352,7 +1352,6 @@ bool TextureSource::generateImagePart(std::string part_of_name,
u32
r1
=
stoi
(
sf
.
next
(
","
));
u32
g1
=
stoi
(
sf
.
next
(
","
));
u32
b1
=
stoi
(
sf
.
next
(
""
));
std
::
string
filename
=
sf
.
next
(
""
);
core
::
dimension2d
<
u32
>
dim
=
baseimg
->
getDimension
();
...
...
@@ -1711,6 +1710,31 @@ bool TextureSource::generateImagePart(std::string part_of_name,
}
}
}
/*
[resize:WxH
Resizes the base image to the given dimensions
*/
else
if
(
str_starts_with
(
part_of_name
,
"[resize"
))
{
if
(
baseimg
==
NULL
)
{
errorstream
<<
"generateImagePart(): baseimg == NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
}
Strfnd
sf
(
part_of_name
);
sf
.
next
(
":"
);
u32
width
=
stoi
(
sf
.
next
(
"x"
));
u32
height
=
stoi
(
sf
.
next
(
""
));
core
::
dimension2d
<
u32
>
dim
(
width
,
height
);
video
::
IImage
*
image
=
m_device
->
getVideoDriver
()
->
createImage
(
video
::
ECF_A8R8G8B8
,
dim
);
baseimg
->
copyToScaling
(
image
);
baseimg
->
drop
();
baseimg
=
image
;
}
else
{
errorstream
<<
"generateImagePart(): Invalid "
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment