Improved asthetics.

This commit is contained in:
Jonathon Anderson 2013-03-11 18:28:58 -05:00
parent ef99c0492e
commit 9a41eb3d6a
6 changed files with 69 additions and 59 deletions

View File

@ -57,7 +57,7 @@ FarMesh::FarMesh(
//m_materials[0].setFlag(video::EMF_BACK_FACE_CULLING, false);
m_materials[0].setFlag(video::EMF_BILINEAR_FILTER, false);
m_materials[0].setFlag(video::EMF_FOG_ENABLE, false);
//m_materials[0].setFlag(video::EMF_ANTI_ALIASING, true);
m_materials[0].setFlag(video::EMF_ANTI_ALIASING, true);
//m_materials[0].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
m_materials[0].setFlag(video::EMF_FOG_ENABLE, true);

View File

@ -304,7 +304,7 @@ void draw_item(video::IVideoDriver *driver, gui::IGUIFont *font, IGameDef *gamed
v2s32(x2, y1),
v2s32(x2 + padding, y2)
), NULL);
/*// Light inside borders
// Light inside borders
driver->draw2DRectangle(c_inside,
core::rect<s32>(
v2s32(x1 - padding/2, y1 - padding/2),
@ -325,7 +325,7 @@ void draw_item(video::IVideoDriver *driver, gui::IGUIFont *font, IGameDef *gamed
v2s32(x2, y1),
v2s32(x2 + padding/2, y2)
), NULL);
*/
}
video::SColor bgcolor2(128,0,0,0);
@ -391,7 +391,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
return;
}
#if 0
s32 padding = imgsize/12;
s32 padding = imgsize/6;
//s32 height = imgsize + padding*2;
s32 width = itemcount*(imgsize+padding*2);
@ -415,9 +415,9 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
if(playeritem == i)
{
video::SColor c_outside(255,255,0,0);
video::SColor c_outside(255,128,128,128);
//video::SColor c_outside(255,0,0,0);
//video::SColor c_inside(255,192,192,192);
video::SColor c_inside(255,64,64,64);
s32 x1 = rect.UpperLeftCorner.X;
s32 y1 = rect.UpperLeftCorner.Y;
s32 x2 = rect.LowerRightCorner.X;
@ -443,7 +443,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
v2s32(x2, y1),
v2s32(x2 + padding, y2)
), NULL);
/*// Light inside borders
// Light inside borders
driver->draw2DRectangle(c_inside,
core::rect<s32>(
v2s32(x1 - padding/2, y1 - padding/2),
@ -463,7 +463,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
core::rect<s32>(
v2s32(x2, y1),
v2s32(x2 + padding/2, y2)
), NULL);*/
), NULL);
}
@ -472,7 +472,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
drawItemStack(driver, font, item, rect, NULL, gamedef);
}
#else
s32 padding = imgsize/12;
s32 padding = imgsize/6;
s32 width = itemcount*(imgsize+padding*2);
v2s32 pos = centerlowerpos - v2s32(width/2, imgsize+padding*2);
draw_item(driver, font, gamedef, pos, imgsize, itemcount,
@ -590,7 +590,7 @@ PointedThing getPointedThing(Client *client, v3f player_position,
if(selected_object != NULL)
{
if(selected_object->doShowSelectionBox())
/*if(selected_object->doShowSelectionBox())
{
aabb3f *selection_box = selected_object->getSelectionBox();
// Box should exist because object was
@ -601,7 +601,7 @@ PointedThing getPointedThing(Client *client, v3f player_position,
hilightboxes.push_back(aabb3f(
selection_box->MinEdge + pos,
selection_box->MaxEdge + pos));
}
}*/
result.type = POINTEDTHING_OBJECT;
@ -2913,10 +2913,10 @@ void the_game(
time_of_day = client.getEnv().getTimeOfDayF();
float maxsm = 0.05;
if(fabs(time_of_day - time_of_day_smooth) > maxsm &&
/*if(//fabs(time_of_day - time_of_day_smooth) > maxsm &&
fabs(time_of_day - time_of_day_smooth + 1.0) > maxsm &&
fabs(time_of_day - time_of_day_smooth - 1.0) > maxsm)
time_of_day_smooth = time_of_day;
time_of_day_smooth = time_of_day;*/
float todsm = 0.05;
if(time_of_day_smooth > 0.8 && time_of_day < 0.2)
time_of_day_smooth = time_of_day_smooth * (1.0-todsm)
@ -3297,7 +3297,8 @@ void the_game(
video::SMaterial m;
//m.Thickness = 10;
m.Thickness = 3;
//m.Thickness = 3;
m.Thickness = 1;
m.Lighting = false;
driver->setMaterial(m);

View File

@ -1103,8 +1103,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
material.setFlag(video::EMF_FOG_ENABLE, true);
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_SIMPLE);
material.AntiAliasing = video::EAAM_SIMPLE;
material.MaterialType
= video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
material.setTexture(0, p.tile.texture.atlas);

View File

@ -453,7 +453,11 @@ video::ITexture *generateTextureFromMesh(scene::IMesh *mesh,
scene::IMeshSceneNode* meshnode = smgr->addMeshSceneNode(mesh, NULL, -1, v3f(0,0,0), v3f(0,0,0), v3f(1,1,1), true);
meshnode->setMaterialFlag(video::EMF_LIGHTING, true);
meshnode->setMaterialFlag(video::EMF_ANTI_ALIASING, true);
scene::IMesh* nodemesh = meshnode->getMesh();
for (u32 i=0; i<nodemesh->getMeshBufferCount(); ++i){
nodemesh->getMeshBuffer(i)->getMaterial().AntiAliasing = video::EAAM_FULL_BASIC;
}
meshnode->setMaterialFlag(video::EMF_ANTI_ALIASING, false);
meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, true);
scene::ICameraSceneNode* camera = smgr->addCameraSceneNode(0,

View File

@ -249,7 +249,7 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version)
writeU8(os, param_type_2);
writeU8(os, is_ground_content);
writeU8(os, light_propagates);
writeU8(os, sunlight_propagates);
writeU8(os, false);
writeU8(os, walkable);
writeU8(os, pointable);
writeU8(os, diggable);

View File

@ -29,7 +29,7 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
mat.Lighting = false;
mat.ZBuffer = video::ECFN_NEVER;
mat.ZWriteEnable = false;
mat.AntiAliasing=0;
mat.AntiAliasing = video::EAAM_SIMPLE;
mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
mat.BackfaceCulling = false;
@ -94,6 +94,19 @@ void Sky::render()
if(m_sunlight_seen)
{
float nightlength = 0.415;
float wn = nightlength / 2;
float wicked_time_of_day = 0;
if(m_time_of_day > wn && m_time_of_day < 1.0 - wn)
wicked_time_of_day = (m_time_of_day - wn)/(1.0-wn*2)*0.5 + 0.25;
else if(m_time_of_day < 0.5)
wicked_time_of_day = m_time_of_day / wn * 0.25;
else
wicked_time_of_day = 1.0 - ((1.0-m_time_of_day) / wn * 0.25);
/*std::cerr<<"time_of_day="<<m_time_of_day<<" -> "
<<"wicked_time_of_day="<<wicked_time_of_day<<std::endl;*/
float sunsize = 0.07;
video::SColorf suncolor_f(1, 1, 0, 1);
suncolor_f.r = 1;
@ -107,18 +120,6 @@ void Sky::render()
float moonsize = 0.04;
video::SColorf mooncolor_f(0.50, 0.57, 0.65, 1);
video::SColorf mooncolor2_f(0.85, 0.875, 0.9, 1);
float nightlength = 0.415;
float wn = nightlength / 2;
float wicked_time_of_day = 0;
if(m_time_of_day > wn && m_time_of_day < 1.0 - wn)
wicked_time_of_day = (m_time_of_day - wn)/(1.0-wn*2)*0.5 + 0.25;
else if(m_time_of_day < 0.5)
wicked_time_of_day = m_time_of_day / wn * 0.25;
else
wicked_time_of_day = 1.0 - ((1.0-m_time_of_day) / wn * 0.25);
/*std::cerr<<"time_of_day="<<m_time_of_day<<" -> "
<<"wicked_time_of_day="<<wicked_time_of_day<<std::endl;*/
video::SColor suncolor = suncolor_f.toSColor();
video::SColor suncolor2 = suncolor2_f.toSColor();
@ -133,8 +134,8 @@ void Sky::render()
driver->setMaterial(m_materials[1]);
//video::SColor cloudyfogcolor(255,255,255,255);
video::SColor cloudyfogcolor = m_bgcolor;
//video::SColor cloudyfogcolor = m_bgcolor.getInterpolated(m_skycolor, 0.5);
//video::SColor cloudyfogcolor = m_bgcolor;
video::SColor cloudyfogcolor = m_bgcolor.getInterpolated(m_skycolor, 0.5);
// Draw far cloudy fog thing
for(u32 j=0; j<4; j++)
@ -183,7 +184,7 @@ void Sky::render()
}
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
}
#if 1 //This may be turned off in the future
driver->setMaterial(m_materials[2]);
{
@ -208,7 +209,7 @@ void Sky::render()
}
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
}
#endif
driver->setMaterial(m_materials[1]);
// Draw sun
@ -367,12 +368,13 @@ void Sky::render()
scene::EPT_QUADS, video::EIT_16BIT);
}while(0);
for(u32 j=0; j<2; j++)
for(u32 j=0; j<4; j++)
{
//video::SColor c = m_skycolor;
video::SColor c = cloudyfogcolor;
vertices[0] = video::S3DVertex(-1,-1.0,-1, 0,0,1, c, t, t);
vertices[1] = video::S3DVertex( 1,-1.0,-1, 0,0,1, c, o, t);
video::SColor d = m_skycolor;
vertices[0] = video::S3DVertex(-1,-1.0,-1, 0,0,1, d, t, t);
vertices[1] = video::S3DVertex( 1,-1.0,-1, 0,0,1, d, o, t);
vertices[2] = video::S3DVertex( 1,-0.02,-1, 0,0,1, c, o, o);
vertices[3] = video::S3DVertex(-1,-0.02,-1, 0,0,1, c, t, o);
for(u32 i=0; i<4; i++){
@ -380,7 +382,10 @@ void Sky::render()
if(j==0)
// Switch from -Z (south) to +X (east)
vertices[i].Pos.rotateXZBy(90);
else
else if(j==1)
// Switch from -Z (south) to +Z (north)
vertices[i].Pos.rotateXZBy(180);
else if(j==2)
// Switch from -Z (south) to -X (west)
vertices[i].Pos.rotateXZBy(-90);
}
@ -410,7 +415,10 @@ void Sky::update(float time_of_day, float time_brightness,
m_time_brightness = time_brightness;
m_sunlight_seen = sunlight_seen;
bool is_dawn = (time_brightness >= 0.20 && time_brightness < 0.35);
bool is_dawn = (time_brightness >= 0.1 && time_brightness < 0.35);
float dawn = 1 - (fabsf(time_brightness - 0.1) / 5);
if(time_brightness > 0.35)
dawn = 1;
//video::SColorf bgcolor_bright_normal_f(170./255,200./255,230./255, 1.0);
video::SColorf bgcolor_bright_normal_f(155./255,193./255,240./255, 1.0);
@ -431,37 +439,35 @@ void Sky::update(float time_of_day, float time_brightness,
video::SColor(255, 240,240,255);
//video::SColorf cloudcolor_bright_dawn_f(1.0, 0.591, 0.4);
//video::SColorf cloudcolor_bright_dawn_f(1.0, 0.65, 0.44);
video::SColorf cloudcolor_bright_dawn_f(1.0, 0.7, 0.5);
video::SColorf cloudcolor_bright_dawn_f(1.0, 0.5, 0.2);
/*
if(sunlight_seen){
//m_brightness = m_brightness * 0.95 + direct_brightness * 0.05;
m_brightness = m_brightness * 0.95 + time_brightness * 0.05;
m_brightness = m_brightness * 0.85 + time_brightness * 0.15;
}
else{
if(direct_brightness < m_brightness)
m_brightness = m_brightness * 0.95 + direct_brightness * 0.05;
else
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
}
}*/
m_brightness = time_brightness;
m_clouds_visible = true;
float color_change_fraction = 0.98;
if(sunlight_seen){
if(is_dawn){
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_dawn_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
skycolor_bright_dawn_f, color_change_fraction);
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
cloudcolor_bright_dawn_f, color_change_fraction);
} else {
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_normal_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
skycolor_bright_normal_f, color_change_fraction);
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
cloudcolor_bright_normal_f, color_change_fraction);
}
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_normal_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
skycolor_bright_normal_f, color_change_fraction);
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
cloudcolor_bright_normal_f, color_change_fraction);
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_dawn_f, dawn);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
skycolor_bright_dawn_f, dawn);
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
cloudcolor_bright_dawn_f, dawn);
} else {
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_indoor_f, color_change_fraction);