mirror of
https://github.com/minetest/irrlicht.git
synced 2024-09-07 05:10:19 +02:00
- 10 year anniversary update - Lighting model reworked. moved to eyespace like openGL. [Specular Highlights, Fog, Sphere/Reflection Map] - increased internal s4DVertex to support 4 Textures and 4 Colors [switchable] - Textures are handled as sRGB during Mipmap Generation. More accurate, less visual disruption - 2D is drawn as 3D like hardware drivers. [switchable]. enables viewport scaling, material2D - Texture Spatial Resolution Limiting working. [lower memory consumption,SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE] - SuperTuxKart 8.0.1 playable git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6086 dfc29bdd-3216-0410-991c-e03cc46cb475
96 lines
3.0 KiB
C++
96 lines
3.0 KiB
C++
// Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten
|
|
// This file is part of the "Irrlicht Engine".
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
#include "IrrCompileConfig.h"
|
|
#include "IBurningShader.h"
|
|
|
|
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
|
|
namespace irr
|
|
{
|
|
|
|
namespace video
|
|
{
|
|
|
|
#define burning_shader_class burning_shader_color
|
|
#define burning_shader_frag "burning_shader_color_fraq.h"
|
|
#include "burning_shader_compile_fragment_default.h"
|
|
|
|
|
|
/*!
|
|
*/
|
|
void burning_shader_class::OnSetMaterial(const SBurningShaderMaterial& material)
|
|
{
|
|
switch (material.org.MaterialType)
|
|
{
|
|
case EMT_TRANSPARENT_ADD_COLOR:
|
|
case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
|
|
case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
|
|
//glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
|
|
|
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
|
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
|
|
//? glBlendFunc(GL_ONE,GL_ZERO) or glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
case EMT_TRANSPARENT_REFLECTION_2_LAYER:
|
|
|
|
case EMT_TRANSPARENT_VERTEX_ALPHA:
|
|
case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
|
|
case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
|
|
RenderPass_ShaderIsTransparent = 1;
|
|
AlphaRef = tofix(material.org.MaterialTypeParam, FIXPOINT_COLOR_MAX);
|
|
break;
|
|
default:
|
|
RenderPass_ShaderIsTransparent = 0;
|
|
AlphaRef = 0;
|
|
break;
|
|
}
|
|
|
|
if (0 == RenderPass_ShaderIsTransparent)
|
|
{
|
|
if (material.org.ZBuffer == ECFN_LESSEQUAL)
|
|
{
|
|
if (material.depth_write) fragmentShader = &burning_shader_class::fragment_depth_less_equal_depth_write_blend_one_zero;
|
|
else fragmentShader = &burning_shader_class::fragment_depth_less_equal_no_depth_write_blend_one_zero;
|
|
}
|
|
else /*if (material.org.ZBuffer == ECFN_DISABLED)*/
|
|
{
|
|
//check triangle on w = 1.f instead..
|
|
#ifdef SOFTWARE_DRIVER_2_BILINEAR
|
|
if (material.org.TextureLayer[0].BilinearFilter) fragmentShader = &burning_shader_class::fragment_nodepth_perspective_blend_one_zero;
|
|
else
|
|
#endif
|
|
fragmentShader = &burning_shader_class::fragment_nodepth_noperspective_blend_one_zero;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (material.org.ZBuffer == ECFN_LESSEQUAL)
|
|
{
|
|
if (material.depth_write) fragmentShader = &burning_shader_class::fragment_depth_less_equal_depth_write_blend_src_alpha_one_minus_src_alpha;
|
|
else fragmentShader = &burning_shader_class::fragment_depth_less_equal_no_depth_write_blend_src_alpha_one_minus_src_alpha;
|
|
}
|
|
else /*if (material.org.ZBuffer == ECFN_DISABLED)*/
|
|
{
|
|
//check triangle on w = 1.f instead..
|
|
#ifdef SOFTWARE_DRIVER_2_BILINEAR
|
|
if (material.org.TextureLayer[0].BilinearFilter) fragmentShader = &burning_shader_class::fragment_nodepth_perspective_blend_src_alpha_one_minus_src_alpha;
|
|
else
|
|
#endif
|
|
fragmentShader = &burning_shader_class::fragment_nodepth_noperspective_blend_src_alpha_one_minus_src_alpha;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace video
|
|
} // end namespace irr
|
|
|
|
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
|