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
c32bd982
Commit
c32bd982
authored
14 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
possibly fixed broken crack textures on some machines
parent
bcd9813a
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/irrlichtwrapper.cpp
+28
-12
28 additions, 12 deletions
src/irrlichtwrapper.cpp
src/main.cpp
+14
-3
14 additions, 3 deletions
src/main.cpp
with
42 additions
and
15 deletions
src/irrlichtwrapper.cpp
+
28
−
12
View file @
c32bd982
...
...
@@ -112,13 +112,22 @@ video::ITexture* IrrlichtWrapper::getTextureDirect(TextureSpec spec)
video
::
ITexture
*
CrackTextureMod
::
make
(
video
::
ITexture
*
original
,
const
char
*
newname
,
video
::
IVideoDriver
*
driver
)
{
// Size of the base image
core
::
dimension2d
<
u32
>
dim
(
16
,
16
);
// Size of the crack image
//core::dimension2d<u32> dim_crack(16, 16 * CRACK_ANIMATION_LENGTH);
// Position to copy the crack to in the base image
core
::
position2d
<
s32
>
pos_base
(
0
,
0
);
// Position to copy the crack from in the crack image
core
::
position2d
<
s32
>
pos_other
(
0
,
16
*
progression
);
video
::
IImage
*
baseimage
=
driver
->
createImage
(
original
,
pos_base
,
dim
);
assert
(
baseimage
);
video
::
IImage
*
crackimage
=
driver
->
createImageFromFile
(
"../data/crack.png"
);
assert
(
crackimage
);
#if 0
video::ITexture *other = driver->getTexture("../data/crack.png");
dstream<<__FUNCTION_NAME<<": crack texture size is "
...
...
@@ -131,26 +140,33 @@ video::ITexture * CrackTextureMod::make(video::ITexture *original,
// the image to fit a texture or something...
video::IImage *otherimage = driver->createImage(
other, core::position2d<s32>(0,0), other->getSize());
// This should work on more systems
// - no, it doesn't, output is more random.
/*video::IImage *otherimage = driver->createImage(
other, core::position2d<s32>(0,0),
v2u32(16, CRACK_ANIMATION_LENGTH * 16));*/
assert(otherimage);
// Now, the image might be 80 or 128 high depending on the computer
// Let's make an image of the right size and copy the possibly
// wrong sized one with scaling
// NOTE: This is an ugly hack.
video::IImage *crackimage = driver->createImage(
baseimage->getColorFormat(), dim_crack);
/*core::rect<s32> clip_rect(v2s32(0,0), dim);
otherimage->copyToWithAlpha(baseimage, v2s32(0,0),
core::rect<s32>(pos_other, dim),
video::SColor(255,255,255,255),
&clip_rect);*/
assert(crackimage);
otherimage
->
copyToWithAlpha
(
baseimage
,
v2s32
(
0
,
0
),
otherimage->copyToScaling(crackimage);
otherimage->drop();
#endif
// Then copy the right part of crackimage to baseimage
crackimage
->
copyToWithAlpha
(
baseimage
,
v2s32
(
0
,
0
),
core
::
rect
<
s32
>
(
pos_other
,
dim
),
video
::
SColor
(
255
,
255
,
255
,
255
),
NULL
);
otherimage
->
drop
();
crackimage
->
drop
();
// Create texture from resulting image
video
::
ITexture
*
newtexture
=
driver
->
addTexture
(
newname
,
baseimage
);
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
14
−
3
View file @
c32bd982
...
...
@@ -183,6 +183,13 @@ TODO: When server sees that client is removing an inexistent block or
TODO: When player dies, throw items on map
TODO: Optimize day/night mesh updating somehow
- create copies of all textures for all lighting values and only
change texture for material?
- Umm... the collecting of the faces is the slow part
-> what about just changing the color values of the existing
meshbuffers? It should go quite fast.
TODO: Map generator version 2
Doing now:
...
...
@@ -1614,8 +1621,8 @@ int main(int argc, char *argv[])
bool
first_loop_after_window_activation
=
true
;
// Time is in milliseconds
// NOTE: getRealTime()
without run()s
causes strange problems in wine
// NOTE:
Have to
call run() between
calls of this to update the timer
// NOTE: getRealTime() causes strange problems in wine
(imprecision?)
// NOTE:
So we have to use getTime() and
call run()
s
between
them
u32
lasttime
=
device
->
getTimer
()
->
getTime
();
while
(
device
->
run
())
...
...
@@ -1862,9 +1869,13 @@ int main(int argc, char *argv[])
v3f
camera_direction
=
v3f
(
0
,
0
,
1
);
camera_direction
.
rotateYZBy
(
camera_pitch
);
camera_direction
.
rotateXZBy
(
camera_yaw
);
// This is at the height of the eyes of the current figure
v3f
camera_position
=
player_position
+
v3f
(
0
,
BS
+
BS
/
2
,
0
);
// This is more like in minecraft
/*v3f camera_position =
player_position + v3f(0, BS+BS*0.65, 0);*/
camera
->
setPosition
(
camera_position
);
// *100.0 helps in large map coordinates
...
...
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