mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 14:12:24 +01:00
Drop fixed pipeline lighting stuff (#15165)
This commit is contained in:
parent
6dfd61cba0
commit
70e169f165
@ -1,4 +1,4 @@
|
|||||||
uniform lowp vec4 emissiveColor;
|
uniform lowp vec4 materialColor;
|
||||||
|
|
||||||
varying lowp vec4 varColor;
|
varying lowp vec4 varColor;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ void main(void)
|
|||||||
vec4 color = inVertexColor;
|
vec4 color = inVertexColor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
color *= emissiveColor;
|
color *= materialColor;
|
||||||
varColor = color;
|
varColor = color;
|
||||||
|
|
||||||
eyeVec = -(mWorldView * inVertexPosition).xyz;
|
eyeVec = -(mWorldView * inVertexPosition).xyz;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
uniform mat4 mWorld;
|
uniform mat4 mWorld;
|
||||||
uniform vec3 dayLight;
|
uniform vec3 dayLight;
|
||||||
uniform float animationTimer;
|
uniform float animationTimer;
|
||||||
uniform lowp vec4 emissiveColor;
|
uniform lowp vec4 materialColor;
|
||||||
|
|
||||||
varying vec3 vNormal;
|
varying vec3 vNormal;
|
||||||
varying vec3 vPosition;
|
varying vec3 vPosition;
|
||||||
@ -115,7 +115,7 @@ void main(void)
|
|||||||
vec4 color = inVertexColor;
|
vec4 color = inVertexColor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
color *= emissiveColor;
|
color *= materialColor;
|
||||||
|
|
||||||
// The alpha gives the ratio of sunlight in the incoming light.
|
// The alpha gives the ratio of sunlight in the incoming light.
|
||||||
nightRatio = 1.0 - color.a;
|
nightRatio = 1.0 - color.a;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
uniform lowp vec4 emissiveColor;
|
uniform lowp vec4 materialColor;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_FragColor = emissiveColor;
|
gl_FragColor = materialColor;
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,6 @@ enum E_MATERIAL_PROP
|
|||||||
//! Corresponds to SMaterial::PointCloud.
|
//! Corresponds to SMaterial::PointCloud.
|
||||||
EMP_POINTCLOUD = 0x2,
|
EMP_POINTCLOUD = 0x2,
|
||||||
|
|
||||||
//! Corresponds to SMaterial::GouraudShading.
|
|
||||||
EMP_GOURAUD_SHADING = 0x4,
|
|
||||||
|
|
||||||
//! Corresponds to SMaterial::Lighting.
|
|
||||||
EMP_LIGHTING = 0x8,
|
|
||||||
|
|
||||||
//! Corresponds to SMaterial::ZBuffer.
|
//! Corresponds to SMaterial::ZBuffer.
|
||||||
EMP_ZBUFFER = 0x10,
|
EMP_ZBUFFER = 0x10,
|
||||||
|
|
||||||
@ -48,9 +42,6 @@ enum E_MATERIAL_PROP
|
|||||||
//! Corresponds to SMaterial::FogEnable.
|
//! Corresponds to SMaterial::FogEnable.
|
||||||
EMP_FOG_ENABLE = 0x800,
|
EMP_FOG_ENABLE = 0x800,
|
||||||
|
|
||||||
//! Corresponds to SMaterial::NormalizeNormals.
|
|
||||||
EMP_NORMALIZE_NORMALS = 0x1000,
|
|
||||||
|
|
||||||
//! Corresponds to SMaterialLayer::TextureWrapU, TextureWrapV and
|
//! Corresponds to SMaterialLayer::TextureWrapU, TextureWrapV and
|
||||||
//! TextureWrapW.
|
//! TextureWrapW.
|
||||||
EMP_TEXTURE_WRAP = 0x2000,
|
EMP_TEXTURE_WRAP = 0x2000,
|
||||||
@ -61,9 +52,6 @@ enum E_MATERIAL_PROP
|
|||||||
//! Corresponds to SMaterial::ColorMask.
|
//! Corresponds to SMaterial::ColorMask.
|
||||||
EMP_COLOR_MASK = 0x8000,
|
EMP_COLOR_MASK = 0x8000,
|
||||||
|
|
||||||
//! Corresponds to SMaterial::ColorMaterial.
|
|
||||||
EMP_COLOR_MATERIAL = 0x10000,
|
|
||||||
|
|
||||||
//! Corresponds to SMaterial::UseMipMaps.
|
//! Corresponds to SMaterial::UseMipMaps.
|
||||||
EMP_USE_MIP_MAPS = 0x20000,
|
EMP_USE_MIP_MAPS = 0x20000,
|
||||||
|
|
||||||
|
@ -194,29 +194,6 @@ enum E_ANTI_ALIASING_MODE
|
|||||||
EAAM_ALPHA_TO_COVERAGE = 4
|
EAAM_ALPHA_TO_COVERAGE = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
//! These flags allow to define the interpretation of vertex color when lighting is enabled
|
|
||||||
/** Without lighting being enabled the vertex color is the only value defining the fragment color.
|
|
||||||
Once lighting is enabled, the four values for diffuse, ambient, emissive, and specular take over.
|
|
||||||
With these flags it is possible to define which lighting factor shall be defined by the vertex color
|
|
||||||
instead of the lighting factor which is the same for all faces of that material.
|
|
||||||
The default is to use vertex color for the diffuse value, another pretty common value is to use
|
|
||||||
vertex color for both diffuse and ambient factor. */
|
|
||||||
enum E_COLOR_MATERIAL
|
|
||||||
{
|
|
||||||
//! Don't use vertex color for lighting
|
|
||||||
ECM_NONE = 0,
|
|
||||||
//! Use vertex color for diffuse light, this is default
|
|
||||||
ECM_DIFFUSE,
|
|
||||||
//! Use vertex color for ambient light
|
|
||||||
ECM_AMBIENT,
|
|
||||||
//! Use vertex color for emissive light
|
|
||||||
ECM_EMISSIVE,
|
|
||||||
//! Use vertex color for specular light
|
|
||||||
ECM_SPECULAR,
|
|
||||||
//! Use vertex color for both diffuse and ambient light
|
|
||||||
ECM_DIFFUSE_AND_AMBIENT
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Names for polygon offset direction
|
//! Names for polygon offset direction
|
||||||
const c8 *const PolygonOffsetDirectionNames[] = {
|
const c8 *const PolygonOffsetDirectionNames[] = {
|
||||||
"Back",
|
"Back",
|
||||||
@ -262,16 +239,14 @@ class SMaterial
|
|||||||
public:
|
public:
|
||||||
//! Default constructor. Creates a solid, lit material with white colors
|
//! Default constructor. Creates a solid, lit material with white colors
|
||||||
SMaterial() :
|
SMaterial() :
|
||||||
MaterialType(EMT_SOLID), AmbientColor(255, 255, 255, 255),
|
MaterialType(EMT_SOLID), ColorParam(0, 0, 0, 0),
|
||||||
DiffuseColor(255, 255, 255, 255), EmissiveColor(0, 0, 0, 0),
|
|
||||||
SpecularColor(255, 255, 255, 255), Shininess(0.0f),
|
|
||||||
MaterialTypeParam(0.0f), Thickness(1.0f), ZBuffer(ECFN_LESSEQUAL),
|
MaterialTypeParam(0.0f), Thickness(1.0f), ZBuffer(ECFN_LESSEQUAL),
|
||||||
AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), ColorMaterial(ECM_DIFFUSE),
|
AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
|
||||||
BlendOperation(EBO_NONE), BlendFactor(0.0f), PolygonOffsetDepthBias(0.f),
|
BlendOperation(EBO_NONE), BlendFactor(0.0f), PolygonOffsetDepthBias(0.f),
|
||||||
PolygonOffsetSlopeScale(0.f), Wireframe(false), PointCloud(false),
|
PolygonOffsetSlopeScale(0.f), Wireframe(false), PointCloud(false),
|
||||||
GouraudShading(true), Lighting(true), ZWriteEnable(EZW_AUTO),
|
ZWriteEnable(EZW_AUTO),
|
||||||
BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false),
|
BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false),
|
||||||
NormalizeNormals(false), UseMipMaps(true)
|
UseMipMaps(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,42 +256,9 @@ public:
|
|||||||
//! Type of the material. Specifies how everything is blended together
|
//! Type of the material. Specifies how everything is blended together
|
||||||
E_MATERIAL_TYPE MaterialType;
|
E_MATERIAL_TYPE MaterialType;
|
||||||
|
|
||||||
//! How much ambient light (a global light) is reflected by this material.
|
//! Custom color parameter, can be used by custom shader materials.
|
||||||
/** The default is full white, meaning objects are completely
|
// See MainShaderConstantSetter in Minetest.
|
||||||
globally illuminated. Reduce this if you want to see diffuse
|
SColor ColorParam;
|
||||||
or specular light effects. */
|
|
||||||
SColor AmbientColor;
|
|
||||||
|
|
||||||
//! How much diffuse light coming from a light source is reflected by this material.
|
|
||||||
/** The default is full white. */
|
|
||||||
SColor DiffuseColor;
|
|
||||||
|
|
||||||
//! Light emitted by this material. Default is to emit no light.
|
|
||||||
SColor EmissiveColor;
|
|
||||||
|
|
||||||
//! How much specular light (highlights from a light) is reflected.
|
|
||||||
/** The default is to reflect white specular light. See
|
|
||||||
SMaterial::Shininess on how to enable specular lights. */
|
|
||||||
SColor SpecularColor;
|
|
||||||
|
|
||||||
//! Value affecting the size of specular highlights.
|
|
||||||
/** A value of 20 is common. If set to 0, no specular
|
|
||||||
highlights are being used. To activate, simply set the
|
|
||||||
shininess of a material to a value in the range [0.5;128]:
|
|
||||||
\code
|
|
||||||
sceneNode->getMaterial(0).Shininess = 20.0f;
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
You can change the color of the highlights using
|
|
||||||
\code
|
|
||||||
sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255);
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
The specular color of the dynamic lights
|
|
||||||
(SLight::SpecularColor) will influence the the highlight color
|
|
||||||
too, but they are set to a useful value by default when
|
|
||||||
creating the light scene node.*/
|
|
||||||
f32 Shininess;
|
|
||||||
|
|
||||||
//! Free parameter, dependent on the material type.
|
//! Free parameter, dependent on the material type.
|
||||||
/** Mostly ignored, used for example in
|
/** Mostly ignored, used for example in
|
||||||
@ -344,14 +286,6 @@ public:
|
|||||||
depth or stencil buffer, or using Red and Green for Stereo rendering. */
|
depth or stencil buffer, or using Red and Green for Stereo rendering. */
|
||||||
u8 ColorMask : 4;
|
u8 ColorMask : 4;
|
||||||
|
|
||||||
//! Defines the interpretation of vertex color in the lighting equation
|
|
||||||
/** Values should be chosen from E_COLOR_MATERIAL.
|
|
||||||
When lighting is enabled, vertex color can be used instead of the
|
|
||||||
material values for light modulation. This allows to easily change e.g. the
|
|
||||||
diffuse light behavior of each face. The default, ECM_DIFFUSE, will result in
|
|
||||||
a very similar rendering as with lighting turned off, just with light shading. */
|
|
||||||
u8 ColorMaterial : 3;
|
|
||||||
|
|
||||||
//! Store the blend operation of choice
|
//! Store the blend operation of choice
|
||||||
/** Values to be chosen from E_BLEND_OPERATION. */
|
/** Values to be chosen from E_BLEND_OPERATION. */
|
||||||
E_BLEND_OPERATION BlendOperation : 4;
|
E_BLEND_OPERATION BlendOperation : 4;
|
||||||
@ -392,12 +326,6 @@ public:
|
|||||||
//! Draw as point cloud or filled triangles? Default: false
|
//! Draw as point cloud or filled triangles? Default: false
|
||||||
bool PointCloud : 1;
|
bool PointCloud : 1;
|
||||||
|
|
||||||
//! Flat or Gouraud shading? Default: true
|
|
||||||
bool GouraudShading : 1;
|
|
||||||
|
|
||||||
//! Will this material be lighted? Default: true
|
|
||||||
bool Lighting : 1;
|
|
||||||
|
|
||||||
//! Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
|
//! Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
|
||||||
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
|
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
|
||||||
to values other than ECFN_DISABLED */
|
to values other than ECFN_DISABLED */
|
||||||
@ -412,10 +340,6 @@ public:
|
|||||||
//! Is fog enabled? Default: false
|
//! Is fog enabled? Default: false
|
||||||
bool FogEnable : 1;
|
bool FogEnable : 1;
|
||||||
|
|
||||||
//! Should normals be normalized?
|
|
||||||
/** Always use this if the mesh lit and scaled. Default: false */
|
|
||||||
bool NormalizeNormals : 1;
|
|
||||||
|
|
||||||
//! Shall mipmaps be used if available
|
//! Shall mipmaps be used if available
|
||||||
/** Sometimes, disabling mipmap usage can be useful. Default: true */
|
/** Sometimes, disabling mipmap usage can be useful. Default: true */
|
||||||
bool UseMipMaps : 1;
|
bool UseMipMaps : 1;
|
||||||
@ -486,26 +410,17 @@ public:
|
|||||||
{
|
{
|
||||||
bool different =
|
bool different =
|
||||||
MaterialType != b.MaterialType ||
|
MaterialType != b.MaterialType ||
|
||||||
AmbientColor != b.AmbientColor ||
|
|
||||||
DiffuseColor != b.DiffuseColor ||
|
|
||||||
EmissiveColor != b.EmissiveColor ||
|
|
||||||
SpecularColor != b.SpecularColor ||
|
|
||||||
Shininess != b.Shininess ||
|
|
||||||
MaterialTypeParam != b.MaterialTypeParam ||
|
MaterialTypeParam != b.MaterialTypeParam ||
|
||||||
Thickness != b.Thickness ||
|
Thickness != b.Thickness ||
|
||||||
Wireframe != b.Wireframe ||
|
Wireframe != b.Wireframe ||
|
||||||
PointCloud != b.PointCloud ||
|
PointCloud != b.PointCloud ||
|
||||||
GouraudShading != b.GouraudShading ||
|
|
||||||
Lighting != b.Lighting ||
|
|
||||||
ZBuffer != b.ZBuffer ||
|
ZBuffer != b.ZBuffer ||
|
||||||
ZWriteEnable != b.ZWriteEnable ||
|
ZWriteEnable != b.ZWriteEnable ||
|
||||||
BackfaceCulling != b.BackfaceCulling ||
|
BackfaceCulling != b.BackfaceCulling ||
|
||||||
FrontfaceCulling != b.FrontfaceCulling ||
|
FrontfaceCulling != b.FrontfaceCulling ||
|
||||||
FogEnable != b.FogEnable ||
|
FogEnable != b.FogEnable ||
|
||||||
NormalizeNormals != b.NormalizeNormals ||
|
|
||||||
AntiAliasing != b.AntiAliasing ||
|
AntiAliasing != b.AntiAliasing ||
|
||||||
ColorMask != b.ColorMask ||
|
ColorMask != b.ColorMask ||
|
||||||
ColorMaterial != b.ColorMaterial ||
|
|
||||||
BlendOperation != b.BlendOperation ||
|
BlendOperation != b.BlendOperation ||
|
||||||
BlendFactor != b.BlendFactor ||
|
BlendFactor != b.BlendFactor ||
|
||||||
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
|
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
|
||||||
|
@ -98,12 +98,6 @@ struct SOverrideMaterial
|
|||||||
case EMP_POINTCLOUD:
|
case EMP_POINTCLOUD:
|
||||||
material.PointCloud = Material.PointCloud;
|
material.PointCloud = Material.PointCloud;
|
||||||
break;
|
break;
|
||||||
case EMP_GOURAUD_SHADING:
|
|
||||||
material.GouraudShading = Material.GouraudShading;
|
|
||||||
break;
|
|
||||||
case EMP_LIGHTING:
|
|
||||||
material.Lighting = Material.Lighting;
|
|
||||||
break;
|
|
||||||
case EMP_ZBUFFER:
|
case EMP_ZBUFFER:
|
||||||
material.ZBuffer = Material.ZBuffer;
|
material.ZBuffer = Material.ZBuffer;
|
||||||
break;
|
break;
|
||||||
@ -140,9 +134,6 @@ struct SOverrideMaterial
|
|||||||
case EMP_FOG_ENABLE:
|
case EMP_FOG_ENABLE:
|
||||||
material.FogEnable = Material.FogEnable;
|
material.FogEnable = Material.FogEnable;
|
||||||
break;
|
break;
|
||||||
case EMP_NORMALIZE_NORMALS:
|
|
||||||
material.NormalizeNormals = Material.NormalizeNormals;
|
|
||||||
break;
|
|
||||||
case EMP_TEXTURE_WRAP:
|
case EMP_TEXTURE_WRAP:
|
||||||
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i) {
|
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i) {
|
||||||
if (EnableLayerProps[i]) {
|
if (EnableLayerProps[i]) {
|
||||||
@ -158,9 +149,6 @@ struct SOverrideMaterial
|
|||||||
case EMP_COLOR_MASK:
|
case EMP_COLOR_MASK:
|
||||||
material.ColorMask = Material.ColorMask;
|
material.ColorMask = Material.ColorMask;
|
||||||
break;
|
break;
|
||||||
case EMP_COLOR_MATERIAL:
|
|
||||||
material.ColorMaterial = Material.ColorMaterial;
|
|
||||||
break;
|
|
||||||
case EMP_USE_MIP_MAPS:
|
case EMP_USE_MIP_MAPS:
|
||||||
material.UseMipMaps = Material.UseMipMaps;
|
material.UseMipMaps = Material.UseMipMaps;
|
||||||
break;
|
break;
|
||||||
|
@ -258,7 +258,6 @@ void CAnimatedMeshSceneNode::render()
|
|||||||
// for debug purposes only:
|
// for debug purposes only:
|
||||||
if (DebugDataVisible && PassCount == 1) {
|
if (DebugDataVisible && PassCount == 1) {
|
||||||
video::SMaterial debug_mat;
|
video::SMaterial debug_mat;
|
||||||
debug_mat.Lighting = false;
|
|
||||||
debug_mat.AntiAliasing = 0;
|
debug_mat.AntiAliasing = 0;
|
||||||
driver->setMaterial(debug_mat);
|
driver->setMaterial(debug_mat);
|
||||||
// show normals
|
// show normals
|
||||||
@ -280,7 +279,6 @@ void CAnimatedMeshSceneNode::render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug_mat.ZBuffer = video::ECFN_DISABLED;
|
debug_mat.ZBuffer = video::ECFN_DISABLED;
|
||||||
debug_mat.Lighting = false;
|
|
||||||
driver->setMaterial(debug_mat);
|
driver->setMaterial(debug_mat);
|
||||||
|
|
||||||
if (DebugDataVisible & scene::EDS_BBOX)
|
if (DebugDataVisible & scene::EDS_BBOX)
|
||||||
@ -316,7 +314,6 @@ void CAnimatedMeshSceneNode::render()
|
|||||||
|
|
||||||
// show mesh
|
// show mesh
|
||||||
if (DebugDataVisible & scene::EDS_MESH_WIRE_OVERLAY) {
|
if (DebugDataVisible & scene::EDS_MESH_WIRE_OVERLAY) {
|
||||||
debug_mat.Lighting = false;
|
|
||||||
debug_mat.Wireframe = true;
|
debug_mat.Wireframe = true;
|
||||||
debug_mat.ZBuffer = video::ECFN_DISABLED;
|
debug_mat.ZBuffer = video::ECFN_DISABLED;
|
||||||
driver->setMaterial(debug_mat);
|
driver->setMaterial(debug_mat);
|
||||||
|
@ -485,7 +485,8 @@ bool CB3DMeshFileLoader::readChunkTRIS(scene::SSkinMeshBuffer *meshBuffer, u32 m
|
|||||||
video::S3DVertex *Vertex = meshBuffer->getVertex(meshBuffer->getVertexCount() - 1);
|
video::S3DVertex *Vertex = meshBuffer->getVertex(meshBuffer->getVertexCount() - 1);
|
||||||
|
|
||||||
if (!HasVertexColors)
|
if (!HasVertexColors)
|
||||||
Vertex->Color = B3dMaterial->Material.DiffuseColor;
|
Vertex->Color = video::SColorf(B3dMaterial->red, B3dMaterial->green,
|
||||||
|
B3dMaterial->blue, B3dMaterial->alpha).toSColor();
|
||||||
else if (Vertex->Color.getAlpha() == 255)
|
else if (Vertex->Color.getAlpha() == 255)
|
||||||
Vertex->Color.setAlpha((s32)(B3dMaterial->alpha * 255.0f));
|
Vertex->Color.setAlpha((s32)(B3dMaterial->alpha * 255.0f));
|
||||||
|
|
||||||
@ -890,23 +891,8 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
B3dMaterial.Material.DiffuseColor = video::SColorf(B3dMaterial.red, B3dMaterial.green, B3dMaterial.blue, B3dMaterial.alpha).toSColor();
|
|
||||||
B3dMaterial.Material.ColorMaterial = video::ECM_NONE;
|
|
||||||
|
|
||||||
//------ Material fx ------
|
//------ Material fx ------
|
||||||
|
|
||||||
if (B3dMaterial.fx & 1) { // full-bright
|
|
||||||
B3dMaterial.Material.AmbientColor = video::SColor(255, 255, 255, 255);
|
|
||||||
B3dMaterial.Material.Lighting = false;
|
|
||||||
} else
|
|
||||||
B3dMaterial.Material.AmbientColor = B3dMaterial.Material.DiffuseColor;
|
|
||||||
|
|
||||||
if (B3dMaterial.fx & 2) // use vertex colors instead of brush color
|
|
||||||
B3dMaterial.Material.ColorMaterial = video::ECM_DIFFUSE_AND_AMBIENT;
|
|
||||||
|
|
||||||
if (B3dMaterial.fx & 4) // flatshaded
|
|
||||||
B3dMaterial.Material.GouraudShading = false;
|
|
||||||
|
|
||||||
if (B3dMaterial.fx & 16) // disable backface culling
|
if (B3dMaterial.fx & 16) // disable backface culling
|
||||||
B3dMaterial.Material.BackfaceCulling = false;
|
B3dMaterial.Material.BackfaceCulling = false;
|
||||||
|
|
||||||
@ -914,8 +900,6 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||||||
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
|
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
B3dMaterial.Material.Shininess = B3dMaterial.shininess;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
B3dStack.erase(B3dStack.size() - 1);
|
B3dStack.erase(B3dStack.size() - 1);
|
||||||
|
@ -85,7 +85,6 @@ void CBillboardSceneNode::render()
|
|||||||
if (DebugDataVisible & scene::EDS_BBOX) {
|
if (DebugDataVisible & scene::EDS_BBOX) {
|
||||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||||
video::SMaterial m;
|
video::SMaterial m;
|
||||||
m.Lighting = false;
|
|
||||||
driver->setMaterial(m);
|
driver->setMaterial(m);
|
||||||
driver->draw3DBox(BBoxSafe, video::SColor(0, 208, 195, 152));
|
driver->draw3DBox(BBoxSafe, video::SColor(0, 208, 195, 152));
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,6 @@ void CMeshSceneNode::render()
|
|||||||
// for debug purposes only:
|
// for debug purposes only:
|
||||||
if (DebugDataVisible && PassCount == 1) {
|
if (DebugDataVisible && PassCount == 1) {
|
||||||
video::SMaterial m;
|
video::SMaterial m;
|
||||||
m.Lighting = false;
|
|
||||||
m.AntiAliasing = 0;
|
m.AntiAliasing = 0;
|
||||||
driver->setMaterial(m);
|
driver->setMaterial(m);
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ CNullDriver::CNullDriver(io::IFileSystem *io, const core::dimension2d<u32> &scre
|
|||||||
FeatureEnabled[i] = true;
|
FeatureEnabled[i] = true;
|
||||||
|
|
||||||
InitMaterial2D.AntiAliasing = video::EAAM_OFF;
|
InitMaterial2D.AntiAliasing = video::EAAM_OFF;
|
||||||
InitMaterial2D.Lighting = false;
|
|
||||||
InitMaterial2D.ZWriteEnable = video::EZW_OFF;
|
InitMaterial2D.ZWriteEnable = video::EZW_OFF;
|
||||||
InitMaterial2D.ZBuffer = video::ECFN_DISABLED;
|
InitMaterial2D.ZBuffer = video::ECFN_DISABLED;
|
||||||
InitMaterial2D.UseMipMaps = false;
|
InitMaterial2D.UseMipMaps = false;
|
||||||
@ -1131,15 +1130,10 @@ void CNullDriver::drawBuffers(const scene::IVertexBuffer *vb,
|
|||||||
void CNullDriver::drawMeshBufferNormals(const scene::IMeshBuffer *mb, f32 length, SColor color)
|
void CNullDriver::drawMeshBufferNormals(const scene::IMeshBuffer *mb, f32 length, SColor color)
|
||||||
{
|
{
|
||||||
const u32 count = mb->getVertexCount();
|
const u32 count = mb->getVertexCount();
|
||||||
const bool normalize = mb->getMaterial().NormalizeNormals;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < count; ++i) {
|
for (u32 i = 0; i < count; ++i) {
|
||||||
core::vector3df normalizedNormal = mb->getNormal(i);
|
core::vector3df normal = mb->getNormal(i);
|
||||||
if (normalize)
|
|
||||||
normalizedNormal.normalize();
|
|
||||||
|
|
||||||
const core::vector3df &pos = mb->getPosition(i);
|
const core::vector3df &pos = mb->getPosition(i);
|
||||||
draw3DLine(pos, pos + (normalizedNormal * length), color);
|
draw3DLine(pos, pos + (normal * length), color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1306,10 +1300,8 @@ void CNullDriver::runOcclusionQuery(scene::ISceneNode *node, bool visible)
|
|||||||
OcclusionQueries[index].Run = 0;
|
OcclusionQueries[index].Run = 0;
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
SMaterial mat;
|
SMaterial mat;
|
||||||
mat.Lighting = false;
|
|
||||||
mat.AntiAliasing = 0;
|
mat.AntiAliasing = 0;
|
||||||
mat.ColorMask = ECP_NONE;
|
mat.ColorMask = ECP_NONE;
|
||||||
mat.GouraudShading = false;
|
|
||||||
mat.ZWriteEnable = EZW_OFF;
|
mat.ZWriteEnable = EZW_OFF;
|
||||||
setMaterial(mat);
|
setMaterial(mat);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
|
|||||||
mtlChanged = false;
|
mtlChanged = false;
|
||||||
}
|
}
|
||||||
if (currMtl)
|
if (currMtl)
|
||||||
v.Color = currMtl->Meshbuffer->Material.DiffuseColor;
|
v.Color = video::SColorf(0.8f, 0.8f, 0.8f, 1.0f).toSColor();
|
||||||
|
|
||||||
// get all vertices data in this face (current line of obj file)
|
// get all vertices data in this face (current line of obj file)
|
||||||
const core::stringc wordBuffer = copyLine(bufPtr, bufEnd);
|
const core::stringc wordBuffer = copyLine(bufPtr, bufEnd);
|
||||||
|
@ -43,10 +43,6 @@ private:
|
|||||||
RecalculateNormals(false)
|
RecalculateNormals(false)
|
||||||
{
|
{
|
||||||
Meshbuffer = new SMeshBuffer();
|
Meshbuffer = new SMeshBuffer();
|
||||||
Meshbuffer->Material.Shininess = 0.0f;
|
|
||||||
Meshbuffer->Material.AmbientColor = video::SColorf(0.2f, 0.2f, 0.2f, 1.0f).toSColor();
|
|
||||||
Meshbuffer->Material.DiffuseColor = video::SColorf(0.8f, 0.8f, 0.8f, 1.0f).toSColor();
|
|
||||||
Meshbuffer->Material.SpecularColor = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f).toSColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SObjMtl(const SObjMtl &o) :
|
SObjMtl(const SObjMtl &o) :
|
||||||
|
@ -1840,112 +1840,11 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial &material, const SMater
|
|||||||
E_OPENGL_FIXED_PIPELINE_STATE tempState = FixedPipelineState;
|
E_OPENGL_FIXED_PIPELINE_STATE tempState = FixedPipelineState;
|
||||||
|
|
||||||
if (resetAllRenderStates || tempState == EOFPS_ENABLE || tempState == EOFPS_DISABLE_TO_ENABLE) {
|
if (resetAllRenderStates || tempState == EOFPS_ENABLE || tempState == EOFPS_DISABLE_TO_ENABLE) {
|
||||||
// material colors
|
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE) {
|
||||||
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE ||
|
glDisable(GL_COLOR_MATERIAL);
|
||||||
lastmaterial.ColorMaterial != material.ColorMaterial) {
|
glDisable(GL_LIGHTING);
|
||||||
switch (material.ColorMaterial) {
|
glShadeModel(GL_SMOOTH);
|
||||||
case ECM_NONE:
|
glDisable(GL_NORMALIZE);
|
||||||
glDisable(GL_COLOR_MATERIAL);
|
|
||||||
break;
|
|
||||||
case ECM_DIFFUSE:
|
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
|
||||||
break;
|
|
||||||
case ECM_AMBIENT:
|
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
|
|
||||||
break;
|
|
||||||
case ECM_EMISSIVE:
|
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
|
|
||||||
break;
|
|
||||||
case ECM_SPECULAR:
|
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
|
|
||||||
break;
|
|
||||||
case ECM_DIFFUSE_AND_AMBIENT:
|
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (material.ColorMaterial != ECM_NONE)
|
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE ||
|
|
||||||
lastmaterial.AmbientColor != material.AmbientColor ||
|
|
||||||
lastmaterial.DiffuseColor != material.DiffuseColor ||
|
|
||||||
lastmaterial.EmissiveColor != material.EmissiveColor ||
|
|
||||||
lastmaterial.ColorMaterial != material.ColorMaterial) {
|
|
||||||
GLfloat color[4];
|
|
||||||
|
|
||||||
const f32 inv = 1.0f / 255.0f;
|
|
||||||
|
|
||||||
if ((material.ColorMaterial != video::ECM_AMBIENT) &&
|
|
||||||
(material.ColorMaterial != video::ECM_DIFFUSE_AND_AMBIENT)) {
|
|
||||||
color[0] = material.AmbientColor.getRed() * inv;
|
|
||||||
color[1] = material.AmbientColor.getGreen() * inv;
|
|
||||||
color[2] = material.AmbientColor.getBlue() * inv;
|
|
||||||
color[3] = material.AmbientColor.getAlpha() * inv;
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((material.ColorMaterial != video::ECM_DIFFUSE) &&
|
|
||||||
(material.ColorMaterial != video::ECM_DIFFUSE_AND_AMBIENT)) {
|
|
||||||
color[0] = material.DiffuseColor.getRed() * inv;
|
|
||||||
color[1] = material.DiffuseColor.getGreen() * inv;
|
|
||||||
color[2] = material.DiffuseColor.getBlue() * inv;
|
|
||||||
color[3] = material.DiffuseColor.getAlpha() * inv;
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (material.ColorMaterial != video::ECM_EMISSIVE) {
|
|
||||||
color[0] = material.EmissiveColor.getRed() * inv;
|
|
||||||
color[1] = material.EmissiveColor.getGreen() * inv;
|
|
||||||
color[2] = material.EmissiveColor.getBlue() * inv;
|
|
||||||
color[3] = material.EmissiveColor.getAlpha() * inv;
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE ||
|
|
||||||
lastmaterial.SpecularColor != material.SpecularColor ||
|
|
||||||
lastmaterial.Shininess != material.Shininess ||
|
|
||||||
lastmaterial.ColorMaterial != material.ColorMaterial) {
|
|
||||||
GLfloat color[4] = {0.f, 0.f, 0.f, 1.f};
|
|
||||||
const f32 inv = 1.0f / 255.0f;
|
|
||||||
|
|
||||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, material.Shininess);
|
|
||||||
// disable Specular colors if no shininess is set
|
|
||||||
if ((material.Shininess != 0.0f) &&
|
|
||||||
(material.ColorMaterial != video::ECM_SPECULAR)) {
|
|
||||||
#ifdef GL_EXT_separate_specular_color
|
|
||||||
if (FeatureAvailable[IRR_EXT_separate_specular_color])
|
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
|
||||||
#endif
|
|
||||||
color[0] = material.SpecularColor.getRed() * inv;
|
|
||||||
color[1] = material.SpecularColor.getGreen() * inv;
|
|
||||||
color[2] = material.SpecularColor.getBlue() * inv;
|
|
||||||
color[3] = material.SpecularColor.getAlpha() * inv;
|
|
||||||
}
|
|
||||||
#ifdef GL_EXT_separate_specular_color
|
|
||||||
else if (FeatureAvailable[IRR_EXT_separate_specular_color])
|
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
|
|
||||||
#endif
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
// shademode
|
|
||||||
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE ||
|
|
||||||
lastmaterial.GouraudShading != material.GouraudShading) {
|
|
||||||
if (material.GouraudShading)
|
|
||||||
glShadeModel(GL_SMOOTH);
|
|
||||||
else
|
|
||||||
glShadeModel(GL_FLAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lighting
|
|
||||||
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE ||
|
|
||||||
lastmaterial.Lighting != material.Lighting) {
|
|
||||||
if (material.Lighting)
|
|
||||||
glEnable(GL_LIGHTING);
|
|
||||||
else
|
|
||||||
glDisable(GL_LIGHTING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fog
|
// fog
|
||||||
@ -1957,15 +1856,6 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial &material, const SMater
|
|||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalization
|
|
||||||
if (resetAllRenderStates || tempState == EOFPS_DISABLE_TO_ENABLE ||
|
|
||||||
lastmaterial.NormalizeNormals != material.NormalizeNormals) {
|
|
||||||
if (material.NormalizeNormals)
|
|
||||||
glEnable(GL_NORMALIZE);
|
|
||||||
else
|
|
||||||
glDisable(GL_NORMALIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set fixed pipeline as active.
|
// Set fixed pipeline as active.
|
||||||
tempState = EOFPS_ENABLE;
|
tempState = EOFPS_ENABLE;
|
||||||
} else if (tempState == EOFPS_ENABLE_TO_DISABLE) {
|
} else if (tempState == EOFPS_ENABLE_TO_DISABLE) {
|
||||||
@ -2405,7 +2295,6 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||||||
}
|
}
|
||||||
|
|
||||||
SMaterial currentMaterial = (!OverrideMaterial2DEnabled) ? InitMaterial2D : OverrideMaterial2D;
|
SMaterial currentMaterial = (!OverrideMaterial2DEnabled) ? InitMaterial2D : OverrideMaterial2D;
|
||||||
currentMaterial.Lighting = false;
|
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
setTransform(ETS_TEXTURE_0, core::IdentityMatrix);
|
setTransform(ETS_TEXTURE_0, core::IdentityMatrix);
|
||||||
|
@ -109,10 +109,6 @@ bool CXMeshFileLoader::load(io::IReadFile *file)
|
|||||||
// default material if nothing loaded
|
// default material if nothing loaded
|
||||||
if (!mesh->Materials.size()) {
|
if (!mesh->Materials.size()) {
|
||||||
mesh->Materials.push_back(video::SMaterial());
|
mesh->Materials.push_back(video::SMaterial());
|
||||||
mesh->Materials[0].DiffuseColor.set(0xff777777);
|
|
||||||
mesh->Materials[0].Shininess = 0.f;
|
|
||||||
mesh->Materials[0].SpecularColor.set(0xff777777);
|
|
||||||
mesh->Materials[0].EmissiveColor.set(0xff000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 i;
|
u32 i;
|
||||||
@ -142,7 +138,7 @@ bool CXMeshFileLoader::load(io::IReadFile *file)
|
|||||||
if (!mesh->HasVertexColors) {
|
if (!mesh->HasVertexColors) {
|
||||||
for (u32 j = 0; j < mesh->FaceMaterialIndices.size(); ++j) {
|
for (u32 j = 0; j < mesh->FaceMaterialIndices.size(); ++j) {
|
||||||
for (u32 id = j * 3 + 0; id <= j * 3 + 2; ++id) {
|
for (u32 id = j * 3 + 0; id <= j * 3 + 2; ++id) {
|
||||||
mesh->Vertices[mesh->Indices[id]].Color = mesh->Buffers[mesh->FaceMaterialIndices[j]]->Material.DiffuseColor;
|
mesh->Vertices[mesh->Indices[id]].Color = 0xff777777;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1478,10 +1478,8 @@ void COpenGL3DriverBase::chooseMaterial2D()
|
|||||||
Material = InitMaterial2D;
|
Material = InitMaterial2D;
|
||||||
|
|
||||||
if (OverrideMaterial2DEnabled) {
|
if (OverrideMaterial2DEnabled) {
|
||||||
OverrideMaterial2D.Lighting = false;
|
|
||||||
OverrideMaterial2D.ZWriteEnable = EZW_OFF;
|
OverrideMaterial2D.ZWriteEnable = EZW_OFF;
|
||||||
OverrideMaterial2D.ZBuffer = ECFN_DISABLED; // it will be ECFN_DISABLED after merge
|
OverrideMaterial2D.ZBuffer = ECFN_DISABLED; // it will be ECFN_DISABLED after merge
|
||||||
OverrideMaterial2D.Lighting = false;
|
|
||||||
|
|
||||||
Material = OverrideMaterial2D;
|
Material = OverrideMaterial2D;
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,7 @@ COpenGL3MaterialBaseCB::COpenGL3MaterialBaseCB() :
|
|||||||
|
|
||||||
void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial &material)
|
void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial &material)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
if (material.Lighting)
|
|
||||||
os::Printer::log("Lighted material not supported in unified driver.", ELL_INFORMATION);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FogEnable = material.FogEnable;
|
FogEnable = material.FogEnable;
|
||||||
|
|
||||||
Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
|
Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ Camera::Camera(MapDrawControl &draw_control, Client *client, RenderingEngine *re
|
|||||||
// all other 3D scene nodes and before the GUI.
|
// all other 3D scene nodes and before the GUI.
|
||||||
m_wieldmgr = smgr->createNewSceneManager();
|
m_wieldmgr = smgr->createNewSceneManager();
|
||||||
m_wieldmgr->addCameraSceneNode();
|
m_wieldmgr->addCameraSceneNode();
|
||||||
m_wieldnode = new WieldMeshSceneNode(m_wieldmgr, -1, false);
|
m_wieldnode = new WieldMeshSceneNode(m_wieldmgr, -1);
|
||||||
m_wieldnode->setItem(ItemStack(), m_client);
|
m_wieldnode->setItem(ItemStack(), m_client);
|
||||||
m_wieldnode->drop(); // m_wieldmgr grabbed it
|
m_wieldnode->drop(); // m_wieldmgr grabbed it
|
||||||
|
|
||||||
|
@ -1223,7 +1223,6 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver,
|
|||||||
local_material.FrontfaceCulling = material.FrontfaceCulling;
|
local_material.FrontfaceCulling = material.FrontfaceCulling;
|
||||||
}
|
}
|
||||||
local_material.BlendOperation = material.BlendOperation;
|
local_material.BlendOperation = material.BlendOperation;
|
||||||
local_material.Lighting = false;
|
|
||||||
driver->setMaterial(local_material);
|
driver->setMaterial(local_material);
|
||||||
++material_swaps;
|
++material_swaps;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ Clouds::Clouds(scene::ISceneManager* mgr, IShaderSource *ssrc,
|
|||||||
assert(ssrc);
|
assert(ssrc);
|
||||||
m_enable_shaders = g_settings->getBool("enable_shaders");
|
m_enable_shaders = g_settings->getBool("enable_shaders");
|
||||||
|
|
||||||
m_material.Lighting = false;
|
|
||||||
m_material.BackfaceCulling = true;
|
m_material.BackfaceCulling = true;
|
||||||
m_material.FogEnable = true;
|
m_material.FogEnable = true;
|
||||||
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
||||||
@ -139,7 +138,7 @@ void Clouds::updateMesh()
|
|||||||
video::SColorf c_side_2_f(m_color);
|
video::SColorf c_side_2_f(m_color);
|
||||||
video::SColorf c_bottom_f(m_color);
|
video::SColorf c_bottom_f(m_color);
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
// shader mixes the base color, set via EmissiveColor
|
// shader mixes the base color, set via ColorParam
|
||||||
c_top_f = c_side_1_f = c_side_2_f = c_bottom_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
c_top_f = c_side_1_f = c_side_2_f = c_bottom_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
c_side_1_f.r *= 0.95f;
|
c_side_1_f.r *= 0.95f;
|
||||||
@ -364,7 +363,7 @@ void Clouds::render()
|
|||||||
|
|
||||||
m_material.BackfaceCulling = is3D();
|
m_material.BackfaceCulling = is3D();
|
||||||
if (m_enable_shaders)
|
if (m_enable_shaders)
|
||||||
m_material.EmissiveColor = m_color.toSColor();
|
m_material.ColorParam = m_color.toSColor();
|
||||||
|
|
||||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||||
driver->setMaterial(m_material);
|
driver->setMaterial(m_material);
|
||||||
|
@ -186,10 +186,10 @@ static bool logOnce(const std::ostringstream &from, std::ostream &log_to)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setEmissiveColor(scene::ISceneNode *node, video::SColor color)
|
static void setColorParam(scene::ISceneNode *node, video::SColor color)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < node->getMaterialCount(); ++i)
|
for (u32 i = 0; i < node->getMaterialCount(); ++i)
|
||||||
node->getMaterial(i).EmissiveColor = color;
|
node->getMaterial(i).ColorParam = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -261,7 +261,6 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
buf->append(vertices, 4, indices, 6);
|
buf->append(vertices, 4, indices, 6);
|
||||||
// Set material
|
// Set material
|
||||||
buf->getMaterial().Lighting = false;
|
|
||||||
buf->getMaterial().BackfaceCulling = false;
|
buf->getMaterial().BackfaceCulling = false;
|
||||||
buf->getMaterial().TextureLayers[0].Texture = tsrc->getTextureForMesh("rat.png");
|
buf->getMaterial().TextureLayers[0].Texture = tsrc->getTextureForMesh("rat.png");
|
||||||
buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
@ -648,12 +647,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
|
|
||||||
auto setMaterial = [this] (video::SMaterial &mat) {
|
auto setMaterial = [this] (video::SMaterial &mat) {
|
||||||
mat.MaterialType = m_material_type;
|
mat.MaterialType = m_material_type;
|
||||||
mat.Lighting = false;
|
|
||||||
mat.FogEnable = true;
|
mat.FogEnable = true;
|
||||||
if (m_enable_shaders) {
|
|
||||||
mat.GouraudShading = false;
|
|
||||||
mat.NormalizeNormals = true;
|
|
||||||
}
|
|
||||||
mat.forEachTexture([] (auto &tex) {
|
mat.forEachTexture([] (auto &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
@ -710,7 +704,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
// Set material
|
// Set material
|
||||||
setMaterial(buf->getMaterial());
|
setMaterial(buf->getMaterial());
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
buf->getMaterial().EmissiveColor = c;
|
buf->getMaterial().ColorParam = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to mesh
|
// Add to mesh
|
||||||
@ -736,7 +730,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
// Set material
|
// Set material
|
||||||
setMaterial(buf->getMaterial());
|
setMaterial(buf->getMaterial());
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
buf->getMaterial().EmissiveColor = c;
|
buf->getMaterial().ColorParam = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to mesh
|
// Add to mesh
|
||||||
@ -936,7 +930,7 @@ void GenericCAO::setNodeLight(const video::SColor &light_color)
|
|||||||
auto *node = getSceneNode();
|
auto *node = getSceneNode();
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
setEmissiveColor(node, light_color);
|
setColorParam(node, light_color);
|
||||||
} else {
|
} else {
|
||||||
if (m_meshnode) {
|
if (m_meshnode) {
|
||||||
setMeshColor(m_meshnode->getMesh(), light_color);
|
setMeshColor(m_meshnode->getMesh(), light_color);
|
||||||
@ -1366,15 +1360,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
material.MaterialTypeParam = m_material_type_param;
|
material.MaterialTypeParam = m_material_type_param;
|
||||||
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
|
||||||
// has directional lighting, it should work automatically.
|
|
||||||
if (!m_prop.colors.empty()) {
|
|
||||||
material.AmbientColor = m_prop.colors[0];
|
|
||||||
material.DiffuseColor = m_prop.colors[0];
|
|
||||||
material.SpecularColor = m_prop.colors[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
material.forEachTexture([=] (auto &tex) {
|
material.forEachTexture([=] (auto &tex) {
|
||||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||||
use_anisotropic_filter);
|
use_anisotropic_filter);
|
||||||
@ -1417,17 +1402,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
use_anisotropic_filter);
|
use_anisotropic_filter);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (u32 i = 0; i < m_prop.colors.size() &&
|
|
||||||
i < m_animated_meshnode->getMaterialCount(); ++i)
|
|
||||||
{
|
|
||||||
video::SMaterial &material = m_animated_meshnode->getMaterial(i);
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
|
||||||
// has directional lighting, it should work automatically.
|
|
||||||
material.AmbientColor = m_prop.colors[i];
|
|
||||||
material.DiffuseColor = m_prop.colors[i];
|
|
||||||
material.SpecularColor = m_prop.colors[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1445,20 +1419,9 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
video::SMaterial &material = m_meshnode->getMaterial(i);
|
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||||
material.MaterialType = m_material_type;
|
material.MaterialType = m_material_type;
|
||||||
material.MaterialTypeParam = m_material_type_param;
|
material.MaterialTypeParam = m_material_type_param;
|
||||||
material.Lighting = false;
|
|
||||||
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
||||||
material.getTextureMatrix(0).makeIdentity();
|
material.getTextureMatrix(0).makeIdentity();
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
|
||||||
// has directional lighting, it should work automatically.
|
|
||||||
if(m_prop.colors.size() > i)
|
|
||||||
{
|
|
||||||
material.AmbientColor = m_prop.colors[i];
|
|
||||||
material.DiffuseColor = m_prop.colors[i];
|
|
||||||
material.SpecularColor = m_prop.colors[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
material.forEachTexture([=] (auto &tex) {
|
material.forEachTexture([=] (auto &tex) {
|
||||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||||
use_anisotropic_filter);
|
use_anisotropic_filter);
|
||||||
@ -1475,15 +1438,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
auto &material = m_meshnode->getMaterial(0);
|
auto &material = m_meshnode->getMaterial(0);
|
||||||
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
|
||||||
// has directional lighting, it should work automatically.
|
|
||||||
if(!m_prop.colors.empty()) {
|
|
||||||
material.AmbientColor = m_prop.colors[0];
|
|
||||||
material.DiffuseColor = m_prop.colors[0];
|
|
||||||
material.SpecularColor = m_prop.colors[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
material.forEachTexture([=] (auto &tex) {
|
material.forEachTexture([=] (auto &tex) {
|
||||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||||
use_anisotropic_filter);
|
use_anisotropic_filter);
|
||||||
@ -1500,19 +1454,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
auto &material = m_meshnode->getMaterial(1);
|
auto &material = m_meshnode->getMaterial(1);
|
||||||
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
|
||||||
// has directional lighting, it should work automatically.
|
|
||||||
if (m_prop.colors.size() >= 2) {
|
|
||||||
material.AmbientColor = m_prop.colors[1];
|
|
||||||
material.DiffuseColor = m_prop.colors[1];
|
|
||||||
material.SpecularColor = m_prop.colors[1];
|
|
||||||
} else if (!m_prop.colors.empty()) {
|
|
||||||
material.AmbientColor = m_prop.colors[0];
|
|
||||||
material.DiffuseColor = m_prop.colors[0];
|
|
||||||
material.SpecularColor = m_prop.colors[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
material.forEachTexture([=] (auto &tex) {
|
material.forEachTexture([=] (auto &tex) {
|
||||||
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
setMaterialFilters(tex, use_bilinear_filter, use_trilinear_filter,
|
||||||
use_anisotropic_filter);
|
use_anisotropic_filter);
|
||||||
|
@ -40,7 +40,6 @@ public:
|
|||||||
video::ITexture *tex = env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png");
|
video::ITexture *tex = env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png");
|
||||||
m_spritenode->forEachMaterial([tex] (auto &mat) {
|
m_spritenode->forEachMaterial([tex] (auto &mat) {
|
||||||
mat.TextureLayers[0].Texture = tex;
|
mat.TextureLayers[0].Texture = tex;
|
||||||
mat.Lighting = false;
|
|
||||||
mat.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
mat.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
mat.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
mat.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||||
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
|
@ -99,7 +99,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||||||
|
|
||||||
// Initialize m_selection_material
|
// Initialize m_selection_material
|
||||||
|
|
||||||
m_selection_material.Lighting = false;
|
|
||||||
|
|
||||||
if (g_settings->getBool("enable_shaders")) {
|
if (g_settings->getBool("enable_shaders")) {
|
||||||
IShaderSource *shdrsrc = client->getShaderSource();
|
IShaderSource *shdrsrc = client->getShaderSource();
|
||||||
@ -121,7 +120,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize m_block_bounds_material
|
// Initialize m_block_bounds_material
|
||||||
m_block_bounds_material.Lighting = false;
|
|
||||||
if (g_settings->getBool("enable_shaders")) {
|
if (g_settings->getBool("enable_shaders")) {
|
||||||
IShaderSource *shdrsrc = client->getShaderSource();
|
IShaderSource *shdrsrc = client->getShaderSource();
|
||||||
auto shader_id = shdrsrc->getShader("default_shader", TILE_MATERIAL_ALPHA);
|
auto shader_id = shdrsrc->getShader("default_shader", TILE_MATERIAL_ALPHA);
|
||||||
@ -155,7 +153,6 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||||||
indices[4] = 3;
|
indices[4] = 3;
|
||||||
indices[5] = 0;
|
indices[5] = 0;
|
||||||
|
|
||||||
b->getMaterial().Lighting = false;
|
|
||||||
b->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
b->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
b->setHardwareMappingHint(scene::EHM_STATIC);
|
b->setHardwareMappingHint(scene::EHM_STATIC);
|
||||||
}
|
}
|
||||||
@ -1205,7 +1202,6 @@ void drawItemStack(
|
|||||||
|
|
||||||
video::SMaterial &material = buf->getMaterial();
|
video::SMaterial &material = buf->getMaterial();
|
||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||||
material.Lighting = false;
|
|
||||||
driver->setMaterial(material);
|
driver->setMaterial(material);
|
||||||
driver->drawMeshBuffer(buf);
|
driver->drawMeshBuffer(buf);
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
|||||||
|
|
||||||
// Create material
|
// Create material
|
||||||
video::SMaterial material;
|
video::SMaterial material;
|
||||||
material.Lighting = false;
|
|
||||||
material.BackfaceCulling = true;
|
material.BackfaceCulling = true;
|
||||||
material.FogEnable = true;
|
material.FogEnable = true;
|
||||||
material.setTexture(0, p.layer.texture);
|
material.setTexture(0, p.layer.texture);
|
||||||
|
@ -99,7 +99,6 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
|
|||||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
buf->append(vertices + 4 * i, 4, indices, 6);
|
buf->append(vertices + 4 * i, 4, indices, 6);
|
||||||
// Set default material
|
// Set default material
|
||||||
buf->getMaterial().Lighting = false;
|
|
||||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||||
buf->getMaterial().forEachTexture([] (auto &tex) {
|
buf->getMaterial().forEachTexture([] (auto &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
@ -401,7 +400,6 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
|
|||||||
for (u16 j = 0; j < 6; j++)
|
for (u16 j = 0; j < 6; j++)
|
||||||
{
|
{
|
||||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
buf->getMaterial().Lighting = false;
|
|
||||||
buf->getMaterial().forEachTexture([] (auto &tex) {
|
buf->getMaterial().forEachTexture([] (auto &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
|
@ -612,7 +612,6 @@ void Minimap::drawMinimap(core::rect<s32> rect)
|
|||||||
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
|
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
|
||||||
tex.MagFilter = video::ETMAGF_LINEAR;
|
tex.MagFilter = video::ETMAGF_LINEAR;
|
||||||
});
|
});
|
||||||
material.Lighting = false;
|
|
||||||
material.TextureLayers[0].Texture = minimap_texture;
|
material.TextureLayers[0].Texture = minimap_texture;
|
||||||
material.TextureLayers[1].Texture = data->heightmap_texture;
|
material.TextureLayers[1].Texture = data->heightmap_texture;
|
||||||
|
|
||||||
|
@ -989,7 +989,6 @@ video::SMaterial ParticleManager::getMaterialForParticle(const ClientParticleTex
|
|||||||
video::SMaterial material;
|
video::SMaterial material;
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
material.Lighting = false;
|
|
||||||
material.BackfaceCulling = false;
|
material.BackfaceCulling = false;
|
||||||
material.FogEnable = true;
|
material.FogEnable = true;
|
||||||
material.forEachTexture([] (auto &tex) {
|
material.forEachTexture([] (auto &tex) {
|
||||||
|
@ -218,15 +218,15 @@ class MainShaderConstantSetter : public IShaderConstantSetter
|
|||||||
CachedVertexShaderSetting<float, 16> m_texture{"mTexture"};
|
CachedVertexShaderSetting<float, 16> m_texture{"mTexture"};
|
||||||
|
|
||||||
// commonly used way to pass material color to shader
|
// commonly used way to pass material color to shader
|
||||||
video::SColor m_emissive_color;
|
video::SColor m_material_color;
|
||||||
CachedPixelShaderSetting<float, 4> m_emissive_color_setting{"emissiveColor"};
|
CachedPixelShaderSetting<float, 4> m_material_color_setting{"materialColor"};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~MainShaderConstantSetter() = default;
|
~MainShaderConstantSetter() = default;
|
||||||
|
|
||||||
virtual void onSetMaterial(const video::SMaterial& material) override
|
virtual void onSetMaterial(const video::SMaterial& material) override
|
||||||
{
|
{
|
||||||
m_emissive_color = material.EmissiveColor;
|
m_material_color = material.ColorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void onSetConstants(video::IMaterialRendererServices *services) override
|
virtual void onSetConstants(video::IMaterialRendererServices *services) override
|
||||||
@ -254,8 +254,8 @@ public:
|
|||||||
m_texture.set(texture, services);
|
m_texture.set(texture, services);
|
||||||
}
|
}
|
||||||
|
|
||||||
video::SColorf emissive_color(m_emissive_color);
|
video::SColorf colorf(m_material_color);
|
||||||
m_emissive_color_setting.set(emissive_color, services);
|
m_material_color_setting.set(colorf, services);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
shadowScreenQuad::shadowScreenQuad()
|
shadowScreenQuad::shadowScreenQuad()
|
||||||
{
|
{
|
||||||
Material.Wireframe = false;
|
Material.Wireframe = false;
|
||||||
Material.Lighting = false;
|
|
||||||
|
|
||||||
video::SColor color(0x0);
|
video::SColor color(0x0);
|
||||||
Vertices[0] = video::S3DVertex(
|
Vertices[0] = video::S3DVertex(
|
||||||
|
@ -39,7 +39,6 @@ using namespace irr::core;
|
|||||||
static video::SMaterial baseMaterial()
|
static video::SMaterial baseMaterial()
|
||||||
{
|
{
|
||||||
video::SMaterial mat;
|
video::SMaterial mat;
|
||||||
mat.Lighting = false;
|
|
||||||
mat.ZBuffer = video::ECFN_DISABLED;
|
mat.ZBuffer = video::ECFN_DISABLED;
|
||||||
mat.ZWriteEnable = video::EZW_OFF;
|
mat.ZWriteEnable = video::EZW_OFF;
|
||||||
mat.AntiAliasing = 0;
|
mat.AntiAliasing = 0;
|
||||||
@ -95,7 +94,6 @@ Sky::Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShade
|
|||||||
|
|
||||||
for (int i = 5; i < 11; i++) {
|
for (int i = 5; i < 11; i++) {
|
||||||
m_materials[i] = baseMaterial();
|
m_materials[i] = baseMaterial();
|
||||||
m_materials[i].Lighting = true;
|
|
||||||
m_materials[i].MaterialType = video::EMT_SOLID;
|
m_materials[i].MaterialType = video::EMT_SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +167,8 @@ void Sky::render()
|
|||||||
video::SColor texel_color (255, texel->getRed(),
|
video::SColor texel_color (255, texel->getRed(),
|
||||||
texel->getGreen(), texel->getBlue());
|
texel->getGreen(), texel->getBlue());
|
||||||
m_sun_tonemap->unlock();
|
m_sun_tonemap->unlock();
|
||||||
m_materials[3].EmissiveColor = texel_color;
|
// Only accessed by our code later, not used by a shader
|
||||||
|
m_materials[3].ColorParam = texel_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_moon_tonemap) {
|
if (m_moon_tonemap) {
|
||||||
@ -178,7 +177,8 @@ void Sky::render()
|
|||||||
video::SColor texel_color (255, texel->getRed(),
|
video::SColor texel_color (255, texel->getRed(),
|
||||||
texel->getGreen(), texel->getBlue());
|
texel->getGreen(), texel->getBlue());
|
||||||
m_moon_tonemap->unlock();
|
m_moon_tonemap->unlock();
|
||||||
m_materials[4].EmissiveColor = texel_color;
|
// Only accessed by our code later, not used by a shader
|
||||||
|
m_materials[4].ColorParam = texel_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
const f32 t = 1.0f;
|
const f32 t = 1.0f;
|
||||||
@ -465,11 +465,11 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
// which keeps previous behavior.
|
// which keeps previous behavior.
|
||||||
if (m_sun_tonemap && m_default_tint) {
|
if (m_sun_tonemap && m_default_tint) {
|
||||||
pointcolor_sun_f.r = pointcolor_light *
|
pointcolor_sun_f.r = pointcolor_light *
|
||||||
(float)m_materials[3].EmissiveColor.getRed() / 255;
|
(float)m_materials[3].ColorParam.getRed() / 255;
|
||||||
pointcolor_sun_f.b = pointcolor_light *
|
pointcolor_sun_f.b = pointcolor_light *
|
||||||
(float)m_materials[3].EmissiveColor.getBlue() / 255;
|
(float)m_materials[3].ColorParam.getBlue() / 255;
|
||||||
pointcolor_sun_f.g = pointcolor_light *
|
pointcolor_sun_f.g = pointcolor_light *
|
||||||
(float)m_materials[3].EmissiveColor.getGreen() / 255;
|
(float)m_materials[3].ColorParam.getGreen() / 255;
|
||||||
} else if (!m_default_tint) {
|
} else if (!m_default_tint) {
|
||||||
pointcolor_sun_f = m_sky_params.fog_sun_tint;
|
pointcolor_sun_f = m_sky_params.fog_sun_tint;
|
||||||
} else {
|
} else {
|
||||||
@ -498,11 +498,11 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
}
|
}
|
||||||
if (m_moon_tonemap && m_default_tint) {
|
if (m_moon_tonemap && m_default_tint) {
|
||||||
pointcolor_moon_f.r = pointcolor_light *
|
pointcolor_moon_f.r = pointcolor_light *
|
||||||
(float)m_materials[4].EmissiveColor.getRed() / 255;
|
(float)m_materials[4].ColorParam.getRed() / 255;
|
||||||
pointcolor_moon_f.b = pointcolor_light *
|
pointcolor_moon_f.b = pointcolor_light *
|
||||||
(float)m_materials[4].EmissiveColor.getBlue() / 255;
|
(float)m_materials[4].ColorParam.getBlue() / 255;
|
||||||
pointcolor_moon_f.g = pointcolor_light *
|
pointcolor_moon_f.g = pointcolor_light *
|
||||||
(float)m_materials[4].EmissiveColor.getGreen() / 255;
|
(float)m_materials[4].ColorParam.getGreen() / 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
video::SColor pointcolor_sun = pointcolor_sun_f.toSColor();
|
video::SColor pointcolor_sun = pointcolor_sun_f.toSColor();
|
||||||
@ -603,11 +603,8 @@ void Sky::draw_sun(video::IVideoDriver *driver, const video::SColor &suncolor,
|
|||||||
// Another magic number that contributes to the ratio 1.57 sun/moon size
|
// Another magic number that contributes to the ratio 1.57 sun/moon size
|
||||||
// difference.
|
// difference.
|
||||||
float d = (sunsize * 1.7) * m_sun_params.scale;
|
float d = (sunsize * 1.7) * m_sun_params.scale;
|
||||||
video::SColor c;
|
video::SColor c = m_sun_tonemap ? m_materials[3].ColorParam :
|
||||||
if (m_sun_tonemap)
|
video::SColor(255, 255, 255, 255);
|
||||||
c = video::SColor(0, 0, 0, 0);
|
|
||||||
else
|
|
||||||
c = video::SColor(255, 255, 255, 255);
|
|
||||||
draw_sky_body(vertices, -d, d, c);
|
draw_sky_body(vertices, -d, d, c);
|
||||||
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
|
place_sky_body(vertices, 90, wicked_time_of_day * 360 - 90);
|
||||||
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
|
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
|
||||||
@ -660,11 +657,8 @@ void Sky::draw_moon(video::IVideoDriver *driver, const video::SColor &mooncolor,
|
|||||||
// Another magic number that contributes to the ratio 1.57 sun/moon size
|
// Another magic number that contributes to the ratio 1.57 sun/moon size
|
||||||
// difference.
|
// difference.
|
||||||
float d = (moonsize * 1.9) * m_moon_params.scale;
|
float d = (moonsize * 1.9) * m_moon_params.scale;
|
||||||
video::SColor c;
|
video::SColor c = m_sun_tonemap ? m_materials[4].ColorParam :
|
||||||
if (m_moon_tonemap)
|
video::SColor(255, 255, 255, 255);
|
||||||
c = video::SColor(0, 0, 0, 0);
|
|
||||||
else
|
|
||||||
c = video::SColor(255, 255, 255, 255);
|
|
||||||
draw_sky_body(vertices, -d, d, c);
|
draw_sky_body(vertices, -d, d, c);
|
||||||
place_sky_body(vertices, -90, wicked_time_of_day * 360 - 90);
|
place_sky_body(vertices, -90, wicked_time_of_day * 360 - 90);
|
||||||
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
|
driver->drawIndexedTriangleList(&vertices[0], 4, indices, 2);
|
||||||
@ -689,7 +683,7 @@ void Sky::draw_stars(video::IVideoDriver * driver, float wicked_time_of_day)
|
|||||||
if (color.a <= 0.0f) // Stars are only drawn when not fully transparent
|
if (color.a <= 0.0f) // Stars are only drawn when not fully transparent
|
||||||
return;
|
return;
|
||||||
if (m_enable_shaders)
|
if (m_enable_shaders)
|
||||||
m_materials[0].EmissiveColor = color.toSColor();
|
m_materials[0].ColorParam = color.toSColor();
|
||||||
else
|
else
|
||||||
setMeshBufferColor(m_stars.get(), color.toSColor());
|
setMeshBufferColor(m_stars.get(), color.toSColor());
|
||||||
|
|
||||||
@ -745,7 +739,6 @@ void Sky::setSunTexture(const std::string &sun_texture,
|
|||||||
m_sun_params.tonemap = sun_tonemap;
|
m_sun_params.tonemap = sun_tonemap;
|
||||||
m_sun_tonemap = tsrc->isKnownSourceImage(sun_tonemap) ?
|
m_sun_tonemap = tsrc->isKnownSourceImage(sun_tonemap) ?
|
||||||
tsrc->getTexture(sun_tonemap) : nullptr;
|
tsrc->getTexture(sun_tonemap) : nullptr;
|
||||||
m_materials[3].Lighting = !!m_sun_tonemap;
|
|
||||||
|
|
||||||
if (m_sun_params.texture == sun_texture && !m_first_update)
|
if (m_sun_params.texture == sun_texture && !m_first_update)
|
||||||
return;
|
return;
|
||||||
@ -765,7 +758,6 @@ void Sky::setSunTexture(const std::string &sun_texture,
|
|||||||
m_materials[3].setTexture(0, m_sun_texture);
|
m_materials[3].setTexture(0, m_sun_texture);
|
||||||
m_materials[3].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
m_materials[3].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
disableTextureFiltering(m_materials[3]);
|
disableTextureFiltering(m_materials[3]);
|
||||||
m_materials[3].Lighting = !!m_sun_tonemap;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,7 +781,6 @@ void Sky::setMoonTexture(const std::string &moon_texture,
|
|||||||
m_moon_params.tonemap = moon_tonemap;
|
m_moon_params.tonemap = moon_tonemap;
|
||||||
m_moon_tonemap = tsrc->isKnownSourceImage(moon_tonemap) ?
|
m_moon_tonemap = tsrc->isKnownSourceImage(moon_tonemap) ?
|
||||||
tsrc->getTexture(moon_tonemap) : nullptr;
|
tsrc->getTexture(moon_tonemap) : nullptr;
|
||||||
m_materials[4].Lighting = !!m_moon_tonemap;
|
|
||||||
|
|
||||||
if (m_moon_params.texture == moon_texture && !m_first_update)
|
if (m_moon_params.texture == moon_texture && !m_first_update)
|
||||||
return;
|
return;
|
||||||
@ -809,7 +800,6 @@ void Sky::setMoonTexture(const std::string &moon_texture,
|
|||||||
m_materials[4].setTexture(0, m_moon_texture);
|
m_materials[4].setTexture(0, m_moon_texture);
|
||||||
m_materials[4].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
m_materials[4].MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
disableTextureFiltering(m_materials[4]);
|
disableTextureFiltering(m_materials[4]);
|
||||||
m_materials[4].Lighting = !!m_moon_tonemap;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,10 +194,9 @@ private:
|
|||||||
static ExtrusionMeshCache *g_extrusion_mesh_cache = nullptr;
|
static ExtrusionMeshCache *g_extrusion_mesh_cache = nullptr;
|
||||||
|
|
||||||
|
|
||||||
WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id, bool lighting):
|
WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id):
|
||||||
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
|
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
|
||||||
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF),
|
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
||||||
m_lighting(lighting)
|
|
||||||
{
|
{
|
||||||
m_enable_shaders = g_settings->getBool("enable_shaders");
|
m_enable_shaders = g_settings->getBool("enable_shaders");
|
||||||
m_anisotropic_filter = g_settings->getBool("anisotropic_filter");
|
m_anisotropic_filter = g_settings->getBool("anisotropic_filter");
|
||||||
@ -390,8 +389,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||||||
// overlay is white, if present
|
// overlay is white, if present
|
||||||
m_colors.emplace_back(true, video::SColor(0xFFFFFFFF));
|
m_colors.emplace_back(true, video::SColor(0xFFFFFFFF));
|
||||||
// initialize the color
|
// initialize the color
|
||||||
if (!m_lighting)
|
setColor(video::SColor(0xFFFFFFFF));
|
||||||
setColor(video::SColor(0xFFFFFFFF));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,8 +466,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize the color
|
// initialize the color
|
||||||
if (!m_lighting)
|
setColor(video::SColor(0xFFFFFFFF));
|
||||||
setColor(video::SColor(0xFFFFFFFF));
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
const std::string inventory_image = item.getInventoryImage(idef);
|
const std::string inventory_image = item.getInventoryImage(idef);
|
||||||
@ -485,8 +482,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||||||
m_colors.emplace_back(true, video::SColor(0xFFFFFFFF));
|
m_colors.emplace_back(true, video::SColor(0xFFFFFFFF));
|
||||||
|
|
||||||
// initialize the color
|
// initialize the color
|
||||||
if (!m_lighting)
|
setColor(video::SColor(0xFFFFFFFF));
|
||||||
setColor(video::SColor(0xFFFFFFFF));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +492,6 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||||||
|
|
||||||
void WieldMeshSceneNode::setColor(video::SColor c)
|
void WieldMeshSceneNode::setColor(video::SColor c)
|
||||||
{
|
{
|
||||||
assert(!m_lighting);
|
|
||||||
scene::IMesh *mesh = m_meshnode->getMesh();
|
scene::IMesh *mesh = m_meshnode->getMesh();
|
||||||
if (!mesh)
|
if (!mesh)
|
||||||
return;
|
return;
|
||||||
@ -535,7 +530,7 @@ void WieldMeshSceneNode::setNodeLightColor(video::SColor color)
|
|||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
|
for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
|
||||||
video::SMaterial &material = m_meshnode->getMaterial(i);
|
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||||
material.EmissiveColor = color;
|
material.ColorParam = color;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setColor(color);
|
setColor(color);
|
||||||
@ -565,11 +560,6 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
|||||||
mesh->setHardwareMappingHint(scene::EHM_DYNAMIC);
|
mesh->setHardwareMappingHint(scene::EHM_DYNAMIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_meshnode->forEachMaterial([this] (auto &mat) {
|
|
||||||
mat.Lighting = m_lighting;
|
|
||||||
// need to normalize normals when lighting is enabled (because of setScale())
|
|
||||||
mat.NormalizeNormals = m_lighting;
|
|
||||||
});
|
|
||||||
m_meshnode->setVisible(true);
|
m_meshnode->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,7 +657,6 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
material.BackfaceCulling = cull_backface;
|
material.BackfaceCulling = cull_backface;
|
||||||
material.Lighting = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rotateMeshXZby(mesh, -45);
|
rotateMeshXZby(mesh, -45);
|
||||||
@ -720,7 +709,6 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
|
|||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
material.BackfaceCulling = true;
|
material.BackfaceCulling = true;
|
||||||
material.Lighting = false;
|
|
||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ struct ItemMesh
|
|||||||
class WieldMeshSceneNode : public scene::ISceneNode
|
class WieldMeshSceneNode : public scene::ISceneNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id = -1, bool lighting = false);
|
WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id = -1);
|
||||||
virtual ~WieldMeshSceneNode();
|
virtual ~WieldMeshSceneNode();
|
||||||
|
|
||||||
void setCube(const ContentFeatures &f, v3f wield_scale);
|
void setCube(const ContentFeatures &f, v3f wield_scale);
|
||||||
@ -132,9 +132,6 @@ private:
|
|||||||
scene::IMeshSceneNode *m_meshnode = nullptr;
|
scene::IMeshSceneNode *m_meshnode = nullptr;
|
||||||
video::E_MATERIAL_TYPE m_material_type;
|
video::E_MATERIAL_TYPE m_material_type;
|
||||||
|
|
||||||
// True if SMaterial::Lighting should be enabled.
|
|
||||||
bool m_lighting;
|
|
||||||
|
|
||||||
bool m_enable_shaders;
|
bool m_enable_shaders;
|
||||||
bool m_anisotropic_filter;
|
bool m_anisotropic_filter;
|
||||||
bool m_bilinear_filter;
|
bool m_bilinear_filter;
|
||||||
|
@ -67,7 +67,6 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
|
|||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.TextureLayers[0].Texture = texture;
|
material.TextureLayers[0].Texture = texture;
|
||||||
material.Lighting = false;
|
|
||||||
material.FogEnable = true;
|
material.FogEnable = true;
|
||||||
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||||
|
@ -1098,13 +1098,9 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
|
|||||||
|
|
||||||
// the default font material
|
// the default font material
|
||||||
SMaterial mat;
|
SMaterial mat;
|
||||||
mat.Lighting = true;
|
|
||||||
mat.ZWriteEnable = video::EZW_OFF;
|
mat.ZWriteEnable = video::EZW_OFF;
|
||||||
mat.NormalizeNormals = true;
|
|
||||||
mat.ColorMaterial = video::ECM_NONE;
|
|
||||||
mat.MaterialType = use_transparency ? video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_SOLID;
|
mat.MaterialType = use_transparency ? video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_SOLID;
|
||||||
mat.MaterialTypeParam = 0.01f;
|
mat.MaterialTypeParam = 0.01f;
|
||||||
mat.DiffuseColor = color;
|
|
||||||
|
|
||||||
wchar_t current_char = 0, previous_char = 0;
|
wchar_t current_char = 0, previous_char = 0;
|
||||||
u32 n = 0;
|
u32 n = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user