Commit 2a62f6d9 authored by haiyoucuv's avatar haiyoucuv

init

parent db5f8677
......@@ -1514,7 +1514,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 106,
"width": 58,
"height": 58
},
"_anchorPoint": {
......
......@@ -283,6 +283,7 @@ export class Snake extends Component {
);
this.head.setPosition(newHeadPos);
this.head.setScale(this.scale, this.scale);
this.head.setSiblingIndex(this.bodyArr.length);
const space = ~~(this.SEGMENT_SPACING * this.scale);
......
......@@ -39,8 +39,8 @@ CCProgram sprite-vs %{
in vec2 a_texCoord;
in vec4 a_color;
out vec4 color;
out vec3 uv0;
out lowp vec4 color;
out mediump vec3 uv0;
vec4 vert () {
vec4 pos = vec4(a_position, 1);
......@@ -57,11 +57,11 @@ CCProgram sprite-vs %{
pos = cc_matViewProj * pos;
#endif
// uv0 = a_texCoord;
float id = mod(a_texCoord.x,10.0);
uv0.x = (a_texCoord.x - id)*0.000001;
uv0.y = a_texCoord.y;
uv0.z = id;
uv0.z = mod(a_texCoord.x,10.0);
//uv0.z = fract(a_texCoord.x*0.1);
//uv0.z = floor(uv0.z*10.0+0.1);
uv0.x = (a_texCoord.x-uv0.z)*0.000001;
#if SAMPLE_FROM_RT
CC_HANDLE_RT_SAMPLE_FLIP(uv0.xy);
......@@ -73,14 +73,14 @@ CCProgram sprite-vs %{
}%
CCProgram sprite-fs %{
precision highp float;
precision mediump float;
#include <builtin/internal/embedded-alpha>
#include <builtin/internal/alpha-test>
in vec4 color;
in lowp vec4 color;
#if USE_TEXTURE
in vec3 uv0;
in mediump vec3 uv0;
#pragma builtin(local)
layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;
uniform sampler2D texture1;
......@@ -96,19 +96,19 @@ CCProgram sprite-fs %{
vec4 o = vec4(1, 1, 1, 1);
#if USE_TEXTURE
if(uv0.z<0.5)
if(uv0.z == 0.0)
o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0.xy);
else if(uv0.z<1.5)
else if(uv0.z == 1.0)
o *= CCSampleWithAlphaSeparated(texture1, uv0.xy);
else if(uv0.z<2.5)
else if(uv0.z == 2.0)
o *= CCSampleWithAlphaSeparated(texture2, uv0.xy);
else if(uv0.z<3.5)
else if(uv0.z == 3.0)
o *= CCSampleWithAlphaSeparated(texture3, uv0.xy);
else if(uv0.z<4.5)
else if(uv0.z == 4.0)
o *= CCSampleWithAlphaSeparated(texture4, uv0.xy);
else if(uv0.z<5.5)
else if(uv0.z == 5.0)
o *= CCSampleWithAlphaSeparated(texture5, uv0.xy);
else if(uv0.z<6.5)
else if(uv0.z == 6.0)
o *= CCSampleWithAlphaSeparated(texture6, uv0.xy);
else
o *= CCSampleWithAlphaSeparated(texture7, uv0.xy);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment