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
594b1895
Commit
594b1895
authored
13 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
Cut down TextureSource verbosity
parent
7696a385
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tile.cpp
+38
-77
38 additions, 77 deletions
src/tile.cpp
with
38 additions
and
77 deletions
src/tile.cpp
+
38
−
77
View file @
594b1895
...
...
@@ -511,14 +511,14 @@ u32 TextureSource::getTextureIdDirect(const std::string &name)
n
=
m_name_to_id
.
find
(
name
);
if
(
n
!=
NULL
)
{
infostream
<<
"getTextureIdDirect():
\"
"
<<
name
<<
"
\"
found in cache"
<<
std
::
endl
;
/*
infostream<<"getTextureIdDirect(): \""<<name
<<"\" found in cache"<<std::endl;
*/
return
n
->
getValue
();
}
}
infostream
<<
"getTextureIdDirect():
\"
"
<<
name
<<
"
\"
NOT found in cache. Creating it."
<<
std
::
endl
;
/*
infostream<<"getTextureIdDirect(): \""<<name
<<"\" NOT found in cache. Creating it."<<std::endl;
*/
/*
Get the base image
...
...
@@ -581,7 +581,7 @@ u32 TextureSource::getTextureIdDirect(const std::string &name)
if
(
image
==
NULL
)
{
infostream
<<
"getTextureIdDirect(): NULL image in "
infostream
<<
"getTextureIdDirect():
WARNING:
NULL image in "
<<
"cache:
\"
"
<<
base_image_name
<<
"
\"
"
<<
std
::
endl
;
}
...
...
@@ -617,7 +617,7 @@ u32 TextureSource::getTextureIdDirect(const std::string &name)
// Generate image according to part of name
if
(
!
generate_image
(
last_part_of_name
,
baseimg
,
m_device
,
&
m_sourcecache
))
{
info
stream
<<
"getTextureIdDirect(): "
error
stream
<<
"getTextureIdDirect(): "
"failed to generate
\"
"
<<
last_part_of_name
<<
"
\"
"
<<
std
::
endl
;
}
...
...
@@ -625,7 +625,7 @@ u32 TextureSource::getTextureIdDirect(const std::string &name)
// If no resulting image, print a warning
if
(
baseimg
==
NULL
)
{
info
stream
<<
"getTextureIdDirect(): baseimg is NULL (attempted to"
error
stream
<<
"getTextureIdDirect(): baseimg is NULL (attempted to"
" create texture
\"
"
<<
name
<<
"
\"
"
<<
std
::
endl
;
}
...
...
@@ -666,7 +666,7 @@ std::string TextureSource::getTextureName(u32 id)
if
(
id
>=
m_atlaspointer_cache
.
size
())
{
info
stream
<<
"TextureSource::getTextureName(): id="
<<
id
error
stream
<<
"TextureSource::getTextureName(): id="
<<
id
<<
" >= m_atlaspointer_cache.size()="
<<
m_atlaspointer_cache
.
size
()
<<
std
::
endl
;
return
""
;
...
...
@@ -702,10 +702,10 @@ void TextureSource::processQueue()
GetRequest
<
std
::
string
,
u32
,
u8
,
u8
>
request
=
m_get_texture_queue
.
pop
();
infostream
<<
"TextureSource::processQueue(): "
/*
infostream<<"TextureSource::processQueue(): "
<<"got texture request with "
<<"name=\""<<request.key<<"\""
<<
std
::
endl
;
<<std::endl;
*/
GetResult
<
std
::
string
,
u32
,
u8
,
u8
>
result
;
...
...
@@ -719,48 +719,11 @@ void TextureSource::processQueue()
void
TextureSource
::
insertSourceImage
(
const
std
::
string
&
name
,
video
::
IImage
*
img
)
{
infostream
<<
"TextureSource::insertSourceImage(): name="
<<
name
<<
std
::
endl
;
//
infostream<<"TextureSource::insertSourceImage(): name="<<name<<std::endl;
assert
(
get_current_thread_id
()
==
m_main_thread
);
m_sourcecache
.
insert
(
name
,
img
,
false
);
#if 0
JMutexAutoLock lock(m_atlaspointer_cache_mutex);
video::IVideoDriver* driver = m_device->getVideoDriver();
assert(driver);
// Create texture
video::ITexture *t = driver->addTexture(name.c_str(), img);
bool reuse_old_id = false;
u32 id = m_atlaspointer_cache.size();
// Check old id without fetching a texture
core::map<std::string, u32>::Node *n;
n = m_name_to_id.find(name);
// If it exists, we will replace the old definition
if(n){
id = n->getValue();
reuse_old_id = true;
}
// Create AtlasPointer
AtlasPointer ap(id);
ap.atlas = t;
ap.pos = v2f(0,0);
ap.size = v2f(1,1);
ap.tiled = 0;
core::dimension2d<u32> dim = img->getDimension();
// Create SourceAtlasPointer and add to containers
SourceAtlasPointer nap(name, ap, img, v2s32(0,0), dim);
if(reuse_old_id)
m_atlaspointer_cache[id] = nap;
else
m_atlaspointer_cache.push_back(nap);
m_name_to_id[name] = id;
#endif
}
void
TextureSource
::
rebuildImagesAndTextures
()
...
...
@@ -891,7 +854,8 @@ void TextureSource::buildMainAtlas(class IGameDef *gamedef)
&
m_sourcecache
);
if
(
img2
==
NULL
)
{
infostream
<<
"TextureSource::buildMainAtlas(): Couldn't generate texture atlas: Couldn't generate image
\"
"
<<
name
<<
"
\"
"
<<
std
::
endl
;
errorstream
<<
"TextureSource::buildMainAtlas(): "
<<
"Couldn't generate image
\"
"
<<
name
<<
"
\"
"
<<
std
::
endl
;
continue
;
}
...
...
@@ -920,8 +884,8 @@ void TextureSource::buildMainAtlas(class IGameDef *gamedef)
pos_in_atlas
.
X
+=
column_width
+
column_padding
;
}
infostream
<<
"TextureSource::buildMainAtlas(): Adding
\"
"
<<
name
<<
"
\"
to texture atlas"
<<
std
::
endl
;
/*
infostream<<"TextureSource::buildMainAtlas(): Adding \""<<name
<<"\" to texture atlas"<<std::endl;
*/
// Tile it a few times in the X direction
u16
xwise_tiling
=
column_width
/
dim
.
Width
;
...
...
@@ -974,8 +938,8 @@ void TextureSource::buildMainAtlas(class IGameDef *gamedef)
if
(
n
){
id
=
n
->
getValue
();
reuse_old_id
=
true
;
infostream
<<
"TextureSource::buildMainAtlas(): "
<<
"Replacing old AtlasPointer"
<<
std
::
endl
;
/*
infostream<<"TextureSource::buildMainAtlas(): "
<<"Replacing old AtlasPointer"<<std::endl;
*/
}
// Create AtlasPointer
...
...
@@ -1090,7 +1054,7 @@ video::IImage* generate_image_from_scratch(std::string name,
// Generate image according to part of name
if
(
!
generate_image
(
last_part_of_name
,
baseimg
,
device
,
sourcecache
))
{
info
stream
<<
"generate_image_from_scratch(): "
error
stream
<<
"generate_image_from_scratch(): "
"failed to generate
\"
"
<<
last_part_of_name
<<
"
\"
"
<<
std
::
endl
;
return
NULL
;
...
...
@@ -1112,12 +1076,9 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
if
(
image
==
NULL
)
{
info
stream
<<
"generate_image(): Could not load image
\"
"
error
stream
<<
"generate_image(): Could not load image
\"
"
<<
part_of_name
<<
"
\"
"
<<
" while building texture"
<<
std
::
endl
;
//return false;
infostream
<<
"generate_image(): Creating a dummy"
errorstream
<<
"generate_image(): Creating a dummy"
<<
" image for
\"
"
<<
part_of_name
<<
"
\"
"
<<
std
::
endl
;
// Just create a dummy image
...
...
@@ -1177,9 +1138,9 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
// A special texture modification
infostream
<<
"generate_image(): generating special "
/*
infostream<<"generate_image(): generating special "
<<"modification \""<<part_of_name<<"\""
<<
std
::
endl
;
<<std::endl;
*/
/*
This is the simplest of all; it just adds stuff to the
...
...
@@ -1200,7 +1161,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
if
(
baseimg
==
NULL
)
{
info
stream
<<
"generate_image(): baseimg==NULL "
error
stream
<<
"generate_image(): baseimg==NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
...
...
@@ -1335,7 +1296,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
if
(
baseimg
==
NULL
)
{
info
stream
<<
"generate_image(): baseimg==NULL "
error
stream
<<
"generate_image(): baseimg==NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
...
...
@@ -1355,7 +1316,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
if
(
baseimg
!=
NULL
)
{
info
stream
<<
"generate_image(): baseimg!=NULL "
error
stream
<<
"generate_image(): baseimg!=NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
...
...
@@ -1365,8 +1326,8 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
std
::
string
path
=
getTexturePath
(
filename
.
c_str
());
infostream
<<
"generate_image(): Loading file
\"
"
<<
filename
<<
"
\"
"
<<
std
::
endl
;
/*
infostream<<"generate_image(): Loading file \""<<filename
<<"\""<<std::endl;
*/
video
::
IImage
*
image
=
sourcecache
->
getOrLoad
(
filename
,
device
);
...
...
@@ -1402,7 +1363,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
if
(
baseimg
!=
NULL
)
{
info
stream
<<
"generate_image(): baseimg!=NULL "
error
stream
<<
"generate_image(): baseimg!=NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
...
...
@@ -1414,14 +1375,14 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
u32
b1
=
stoi
(
sf
.
next
(
":"
));
std
::
string
filename
=
sf
.
next
(
""
);
infostream
<<
"generate_image(): Loading file
\"
"
<<
filename
<<
"
\"
"
<<
std
::
endl
;
/*
infostream<<"generate_image(): Loading file \""<<filename
<<"\""<<std::endl;
*/
video
::
IImage
*
image
=
sourcecache
->
getOrLoad
(
filename
,
device
);
if
(
image
==
NULL
)
{
info
stream
<<
"generate_image(): Loading file
\"
"
error
stream
<<
"generate_image(): Loading file
\"
"
<<
filename
<<
"
\"
failed"
<<
std
::
endl
;
}
else
...
...
@@ -1456,7 +1417,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
if
(
baseimg
!=
NULL
)
{
info
stream
<<
"generate_image(): baseimg!=NULL "
error
stream
<<
"generate_image(): baseimg!=NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
...
...
@@ -1471,14 +1432,14 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
u32
b2
=
stoi
(
sf
.
next
(
":"
));
std
::
string
filename
=
sf
.
next
(
""
);
infostream
<<
"generate_image(): Loading filename
\"
"
<<
filename
<<
"
\"
"
<<
std
::
endl
;
/*
infostream<<"generate_image(): Loading filename \""<<filename
<<"\""<<std::endl;
*/
video
::
IImage
*
image
=
sourcecache
->
getOrLoad
(
filename
,
device
);
if
(
image
==
NULL
)
{
info
stream
<<
"generate_image(): Loading file
\"
"
error
stream
<<
"generate_image(): Loading file
\"
"
<<
filename
<<
"
\"
failed"
<<
std
::
endl
;
}
else
...
...
@@ -1518,7 +1479,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
{
if
(
baseimg
!=
NULL
)
{
info
stream
<<
"generate_image(): baseimg!=NULL "
error
stream
<<
"generate_image(): baseimg!=NULL "
<<
"for part_of_name=
\"
"
<<
part_of_name
<<
"
\"
, cancelling."
<<
std
::
endl
;
return
false
;
...
...
@@ -1536,7 +1497,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
if
(
driver
->
queryFeature
(
video
::
EVDF_RENDER_TO_TARGET
)
==
false
)
{
info
stream
<<
"generate_image(): EVDF_RENDER_TO_TARGET"
error
stream
<<
"generate_image(): EVDF_RENDER_TO_TARGET"
" not supported. Creating fallback image"
<<
std
::
endl
;
baseimg
=
generate_image_from_scratch
(
imagename_top
,
device
,
sourcecache
);
...
...
@@ -1649,7 +1610,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
}
else
{
info
stream
<<
"generate_image(): Invalid "
error
stream
<<
"generate_image(): Invalid "
" modification:
\"
"
<<
part_of_name
<<
"
\"
"
<<
std
::
endl
;
}
}
...
...
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