fixes mipmap issue with parsing Sampler

This commit is contained in:
Ricardo Quesada 2015-05-13 10:24:32 -07:00
parent 1007c0bfdb
commit e95de4de62
4 changed files with 16 additions and 179 deletions

View File

@ -248,7 +248,7 @@ bool Material::parseSampler(Pass* pass, Properties* textureProperties)
// valid options: NEAREST, LINEAR, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR
const char* minFilter = getOptionalString(textureProperties, "minFilter", mipmap ? "LINEAR_MIPMAP_NEAREST" : "LINEAR");
const char* minFilter = getOptionalString(textureProperties, "minFilter", usemipmap ? "LINEAR_MIPMAP_NEAREST" : "LINEAR");
if (strcasecmp(minFilter, "NEAREST")==0)
texParams.minFilter = GL_NEAREST;
else if(strcasecmp(minFilter, "LINEAR")==0)

View File

@ -199,7 +199,7 @@ void Material_3DEffects::onEnter()
auto light2 = DirectionLight::create(Vec3(-1,1,0), Color3B::GREEN);
addChild(light2);
this->schedule(CC_CALLBACK_1(Material_3DEffects::changeMaterial, this), 3, "cookie");
this->schedule(CC_CALLBACK_1(Material_3DEffects::changeMaterial, this), 1, "cookie");
_techniqueState = 0;
}

View File

@ -4,42 +4,22 @@ material sample
{
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
defines = THIS_IS_AN_EXAMPLE 1;TOMORROW_IS_HOLIDAY 2
vertexShader = Shaders/example_simple.vsh
fragmentShader = Shaders/example_Blur.fsh
blurRadius = 10
// Uniforms
blurRadius = 3
sampleNum = 5
resolution = 100,100
}
sampler 0
{
path = Images/grossinis_sister1.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
technique outline
{
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
vertexShader = Shaders/example_simple.vsh
@ -48,53 +28,23 @@ material sample
u_radius = 0.01
u_threshold = 1.75
}
sampler 0
{
path = Images/grossinis_sister1.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
technique noise {
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
vertexShader = Shaders/example_simple.vsh
fragmentShader = Shaders/example_Noisy.fsh
resolution = 100,100
}
sampler 0
{
path = Images/grossinis_sister1.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
technique edge_detect
{
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
defines =
@ -102,69 +52,6 @@ material sample
fragmentShader = Shaders/example_edgeDetection.fsh
resolution = 100, 100
}
sampler 0
{
path = Images/grossinis_sister1.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
technique gray+blur
{
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
defines = TEXTURE_REPEAT
vertexShader = Shaders/example_simple.vsh
fragmentShader = Shaders/example_Blur.fsh
blurRadius = 10
sampleNum = 5
resolution = 100, 100
}
sampler 0
{
path = Images/grossinis_sister1.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
pass 1
{
renderState
{
blend = true
blendSrc = ONE_MINUS_SRC_ALPHA
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
defines =
vertexShader = Shaders/example_simple.vsh
fragmentShader = Shaders/example_greyScale.fsh
}
sampler 0
{
path = Images/grossinis_sister1.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
}

View File

@ -4,12 +4,6 @@ material spaceship
{
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
vertexShader = Shaders3D/3d_position_tex.vert
@ -18,11 +12,6 @@ material spaceship
sampler 0
{
path = Sprite3DTest/boss.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
@ -31,12 +20,6 @@ material spaceship
{
pass 0
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
defines = MAX_POINT_LIGHT_NUM 1;MAX_SPOT_LIGHT_NUM 1;MAX_DIRECTIONAL_LIGHT_NUM 1
@ -46,11 +29,6 @@ material spaceship
sampler 0
{
path = Sprite3DTest/boss.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}
@ -61,82 +39,54 @@ material spaceship
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
cullFace = true
cullFaceSide = FRONT
depthTest = true
cullFace = true
cullFaceSide = BACK
depthTest = false
}
shader
{
vertexShader = Shaders3D/OutLine.vert
fragmentShader = Shaders3D/OutLine.frag
OutLineColor = 1,0,0
OutlineWidth = 0.01
// Uniforms
OutLineColor = 1,1,0
OutlineWidth = 0.04
}
sampler 0
{
path = Sprite3DTest/boss.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
pass outline thick
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
cullFace = true
cullFaceSide = FRONT
depthTest = true
cullFace = true
cullFaceSide = FRONT
depthTest = true
}
shader
{
vertexShader = Shaders3D/OutLine.vert
fragmentShader = Shaders3D/OutLine.frag
OutLineColor = 0,0,1
OutlineWidth = 0.02
// Uniforms
OutLineColor = 0,0,1
OutlineWidth = 0.02
}
sampler 0
{
path = Sprite3DTest/boss.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
pass 1
{
renderState
{
blend = true
blendSrc = ONE
blendDst = ONE_MINUS_SRC_ALPHA
}
shader
{
vertexShader = Shaders3D/3d_position_tex.vert
fragmentShader = Shaders3D/3d_color_tex.frag
}
sampler 0
{
path = Sprite3DTest/boss.png
wrapS = CLAMP_TO_EDGE
wrapT = CLAMP_TO_EDGE
minFilter = LINEAR
magFilter = LINEAR
mipmap = false
}
}
}