2渲3台球

This commit is contained in:
ruanwujing 2024-04-11 17:40:30 +08:00
parent d3d3738614
commit 7ae9363d9a
22 changed files with 4492 additions and 1 deletions

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "b58a5597-a8f4-4b9e-b863-a25ae3b0e452",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,127 @@
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
CCEffect %{
techniques:
- passes:
- vert: sprite-vs:vert
frag: sprite-fs:frag
depthStencilState:
depthTest: false
depthWrite: false
blendState:
targets:
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendDstAlpha: one_minus_src_alpha
rasterizerState:
cullMode: none
properties:
b_matrix: { value:[
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 0]}
light_pos: {value: [0.5, -0.5, 1, 1]}
}%
CCProgram sprite-vs %{
precision highp float;
#include <builtin/uniforms/cc-global>
#if USE_LOCAL
#include <builtin/uniforms/cc-local>
#endif
#if SAMPLE_FROM_RT
#include <common/common-define>
#endif
in vec3 a_position;
in vec2 a_texCoord;
in vec4 a_color;
out vec4 color;
out vec2 uv0;
vec4 vert () {
vec4 pos = vec4(a_position, 1);
#if USE_LOCAL
pos = cc_matWorld * pos;
#endif
#if USE_PIXEL_ALIGNMENT
pos = cc_matView * pos;
pos.xyz = floor(pos.xyz);
pos = cc_matProj * pos;
#else
pos = cc_matViewProj * pos;
#endif
uv0 = a_texCoord;
#if SAMPLE_FROM_RT
CC_HANDLE_RT_SAMPLE_FLIP(uv0);
#endif
color = a_color;
return pos;
}
}%
CCProgram sprite-fs %{
precision highp float;
#include <builtin/internal/embedded-alpha>
in vec4 color;
in vec2 uv0;
uniform Constant {
mat4x4 b_matrix;
vec4 light_pos;
};
#pragma builtin(local)
layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;
vec4 frag () {
vec2 uv = fract(uv0 * 4.0);
vec2 id = floor(uv0 * 4.0);
vec2 xy = uv * 2.0 - 1.0;
float z = sqrt(1.0 - length(xy));
vec3 _p3d = vec3(xy, z);
vec4 p = b_matrix * vec4(_p3d, 1.0);
vec3 p3d = p.xyz;
vec4 background = vec4(0.0, 0.0, 0.0, 0.0);
vec4 ballColor = color;
#if USE_BELT
// 上下两个白圈的中心店
vec3 white1 = vec3(0.0, 1.0, 0.0);
vec3 white2 = vec3(0.0, -1.0, 0.0);
float whiteLen = 0.7;
vec3 dw1 = white1 - p3d;
vec3 dw2 = white2 - p3d;
float dw = min(dot(dw1, dw1), dot(dw2, dw2));
ballColor = mix(ballColor, vec4(1.0, 1.0, 1.0, 1.0), smoothstep(0.0, -0.1, dw - whiteLen));
#endif
vec2 _xy = p3d.xy * 0.8 + 0.5;
vec2 _uv = _xy * 0.25 + id * 0.25;
vec4 numColor = CCSampleWithAlphaSeparated(cc_spriteTexture, _uv);
vec4 o = mix(ballColor, numColor, smoothstep(0., -0.1, length(_xy - 0.5) - 0.48) * step(0.0, p3d.z));
o = mix(background, o, smoothstep(0.0, -0.1, length(xy) - 1.0));
#if USE_LIGHT
vec3 lightDir = normalize(light_pos.xyz - _p3d.xyz);
float d = dot(normalize(_p3d.xyz), lightDir);
d = clamp(d, 0.0, 1.0);
d = sqrt(d);
float nol = 0.5 + 0.5 * d;
o *= vec4(nol, nol, nol, 1.0);
#endif
return o;
}
}%

View File

@ -0,0 +1,11 @@
{
"ver": "1.7.1",
"importer": "effect",
"imported": true,
"uuid": "852de7ce-1d24-4b8b-bfb1-b3e424877097",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@ -98,8 +98,13 @@ CCProgram sprite-fs %{
vec2 uv_center = (id + 0.5) / vec2(columns, rows);
float exp = sizeExpand + 1.0;
vec2 uv = (uv0 - uv_center) * vec2(columns, rows) * exp;
o *= CCSampleWithAlphaSeparated(cc_spriteTexture, (uv0 - uv_center) * exp + uv_center);
vec2 uv = (uv0 - uv_center) * vec2(columns, rows) * exp;
float dy = sin(uv0.y * 95.0) * 0.05;
uv.x += dy;
// float dx = sin(uv0.x * 95.0) * 0.05;
// uv.y += dx;
float d = sdBox(uv, vec2(0.5, 0.5));
float rad = radius;

View File

@ -0,0 +1,31 @@
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"_effectAsset": {
"__uuid__": "852de7ce-1d24-4b8b-bfb1-b3e424877097",
"__expectedType__": "cc.EffectAsset"
},
"_techIdx": 0,
"_defines": [
{
"USE_LIGHT": true
}
],
"_states": [
{
"rasterizerState": {},
"depthStencilState": {},
"blendState": {
"targets": [
{}
]
}
}
],
"_props": [
{}
]
}

View File

@ -0,0 +1,11 @@
{
"ver": "1.0.21",
"importer": "material",
"imported": true,
"uuid": "a47bb98e-bb21-4eef-806b-ad5bb85c6303",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,32 @@
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"_effectAsset": {
"__uuid__": "852de7ce-1d24-4b8b-bfb1-b3e424877097",
"__expectedType__": "cc.EffectAsset"
},
"_techIdx": 0,
"_defines": [
{
"USE_BELT": true,
"USE_LIGHT": true
}
],
"_states": [
{
"rasterizerState": {},
"depthStencilState": {},
"blendState": {
"targets": [
{}
]
}
}
],
"_props": [
{}
]
}

View File

@ -0,0 +1 @@
{"ver":"1.0.21","importer":"material","imported":true,"uuid":"86aa73f6-caab-43af-9193-770d0798dfda","files":[".json"],"subMetas":{},"userData":{}}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "0a03a549-a583-4d37-b489-ab254ae5bf4c",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>frames</key>
<dict>
<key>00.png</key>
<dict>
<key>frame</key>
<string>{{0,0},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>01.png</key>
<dict>
<key>frame</key>
<string>{{32,0},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>02.png</key>
<dict>
<key>frame</key>
<string>{{64,0},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>03.png</key>
<dict>
<key>frame</key>
<string>{{96,0},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>04.png</key>
<dict>
<key>frame</key>
<string>{{0,32},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>05.png</key>
<dict>
<key>frame</key>
<string>{{32,32},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>06.png</key>
<dict>
<key>frame</key>
<string>{{64,32},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>07.png</key>
<dict>
<key>frame</key>
<string>{{96,32},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>08.png</key>
<dict>
<key>frame</key>
<string>{{0,64},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>09.png</key>
<dict>
<key>frame</key>
<string>{{32,64},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>10.png</key>
<dict>
<key>frame</key>
<string>{{64,64},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>11.png</key>
<dict>
<key>frame</key>
<string>{{96,64},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>12.png</key>
<dict>
<key>frame</key>
<string>{{0,96},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>13.png</key>
<dict>
<key>frame</key>
<string>{{32,96},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>14.png</key>
<dict>
<key>frame</key>
<string>{{64,96},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
<key>15.png</key>
<dict>
<key>frame</key>
<string>{{96,96},{32,32}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{32,32}}</string>
<key>sourceSize</key>
<string>{32,32}</string>
</dict>
</dict>
<key>metadata</key>
<dict>
<key>format</key>
<integer>2</integer>
<key>realTextureFileName</key>
<string>tiles.png</string>
<key>size</key>
<string>{128,128}</string>
<key>smartupdate</key>
<string>$TexturePacker:SmartUpdate:b691f5749b8d03f36e7b74ed51f8f4f2:c54e714565c7ccc13e4871cd09591cae:e7ba09821896df177254bf002289be44$</string>
<key>textureFileName</key>
<string>tiles.png</string>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,753 @@
{
"ver": "1.0.8",
"importer": "sprite-atlas",
"imported": true,
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00",
"files": [
".json"
],
"subMetas": {
"93043": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@93043",
"displayName": "",
"id": "93043",
"name": "01",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 32,
"trimY": 0,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"bb1a3": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@bb1a3",
"displayName": "",
"id": "bb1a3",
"name": "00",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"a6b9d": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@a6b9d",
"displayName": "",
"id": "a6b9d",
"name": "02",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 64,
"trimY": 0,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"ecffe": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@ecffe",
"displayName": "",
"id": "ecffe",
"name": "03",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 96,
"trimY": 0,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"74ef1": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@74ef1",
"displayName": "",
"id": "74ef1",
"name": "04",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 32,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"7d214": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@7d214",
"displayName": "",
"id": "7d214",
"name": "05",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 32,
"trimY": 32,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"fea17": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@fea17",
"displayName": "",
"id": "fea17",
"name": "06",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 64,
"trimY": 32,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"d7755": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@d7755",
"displayName": "",
"id": "d7755",
"name": "07",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 96,
"trimY": 32,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"fe069": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@fe069",
"displayName": "",
"id": "fe069",
"name": "08",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 64,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"0f466": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@0f466",
"displayName": "",
"id": "0f466",
"name": "09",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 32,
"trimY": 64,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"d6710": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@d6710",
"displayName": "",
"id": "d6710",
"name": "10",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 64,
"trimY": 64,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"6422a": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@6422a",
"displayName": "",
"id": "6422a",
"name": "11",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 96,
"trimY": 64,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"cdab0": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@cdab0",
"displayName": "",
"id": "cdab0",
"name": "12",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 96,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"c10f9": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@c10f9",
"displayName": "",
"id": "c10f9",
"name": "13",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 32,
"trimY": 96,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"a8656": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@a8656",
"displayName": "",
"id": "a8656",
"name": "14",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 64,
"trimY": 96,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"979f3": {
"importer": "sprite-frame",
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00@979f3",
"displayName": "",
"id": "979f3",
"name": "15",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 96,
"trimY": 96,
"width": 32,
"height": 32,
"rawWidth": 32,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"atlasTextureName": "tiles.png",
"format": 2,
"uuid": "6bb9b7d4-7e62-4501-a638-ba268f838f00",
"textureUuid": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"displayName": "tiles",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@f9941",
"displayName": "tiles",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "none",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": false,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-64,
-64,
0,
64,
-64,
0,
-64,
64,
0,
64,
64,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
128,
128,
128,
0,
0,
128,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-64,
-64,
0
],
"maxPos": [
64,
64,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"redirect": "63eaf9a3-153a-4e2d-9abd-91cbbb7d63a4@f9941"
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "41f5d44f-0e70-49de-b16b-cdcb1e3b4d7a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "0cc4805c-6f4e-45d6-9ba4-d4d10a601975",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,66 @@
import { _decorator, Component, Mat4, Sprite, v3 } from 'cc';
const { ccclass, property } = _decorator;
// dynamicAtlasManager.enabled = false;
@ccclass('TestBilliards')
export class TestBilliards extends Component {
@property
public scrollAxis = v3(1, 0, 0)
private matrix = new Mat4();
private mat = [
1, 0, 0,
0, 1, 0,
0, 0, 1]
@property
public scrollSpeed = 0;
start() {
}
scroll(rad, x, y, z) {
// 矩阵旋转
// 传入的是逆矩阵,所以计算反向旋转
// 因为只需要计算3d旋转所以用3x3矩阵表示
const s = Math.sin(-rad);
const c = Math.cos(-rad);
const t = 1 - c;
let a = this.mat;
const a00 = a[0]; const a01 = a[1]; const a02 = a[2];
const a10 = a[3]; const a11 = a[4]; const a12 = a[5];
const a20 = a[6]; const a21 = a[7]; const a22 = a[8];
const b00 = x * x * t + c; const b01 = y * x * t + z * s; const b02 = z * x * t - y * s;
const b10 = x * y * t - z * s; const b11 = y * y * t + c; const b12 = z * y * t + x * s;
const b20 = x * z * t + y * s; const b21 = y * z * t - x * s; const b22 = z * z * t + c;
a[0] = a00 * b00 + a10 * b01 + a20 * b02;
a[1] = a01 * b00 + a11 * b01 + a21 * b02;
a[2] = a02 * b00 + a12 * b01 + a22 * b02;
a[3] = a00 * b10 + a10 * b11 + a20 * b12;
a[4] = a01 * b10 + a11 * b11 + a21 * b12;
a[5] = a02 * b10 + a12 * b11 + a22 * b12;
a[6] = a00 * b20 + a10 * b21 + a20 * b22;
a[7] = a01 * b20 + a11 * b21 + a21 * b22;
a[8] = a02 * b20 + a12 * b21 + a22 * b22;
}
update(dt) {
let rad = dt * this.scrollSpeed;
this.scroll(rad, this.scrollAxis.x, this.scrollAxis.y, this.scrollAxis.z);
let a = this.mat
this.matrix.set(
a[0], a[1], a[2], 0,
a[3], a[4], a[5], 0,
a[6], a[7], a[8], 0,
0, 0, 0, 0,)
this.getComponent(Sprite).material.setProperty("b_matrix", this.matrix)
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ca0bf6b0-a6ae-4cba-99fa-d512d0df98e0",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,28 @@
import { _decorator, Component, Node, v3 } from 'cc';
import { TestBilliards } from './TestBilliards';
const { ccclass, property } = _decorator;
@ccclass('TestBilliardsParent')
export class TestBilliardsParent extends Component {
start() {
for (let i = 0; i < this.node.children.length; i++) {
let ball:TestBilliards = this.node.children[i].getComponent(TestBilliards);
ball.scrollSpeed = (i + 1);
let ax = i % 4;
let ay = Math.floor(i / 4);
let az = Math.sqrt(18 - ax * ax - ay * ay);
let len = Math.sqrt(18);
ball.scrollAxis = v3(ax / len, ay / len, az / len);
}
}
update(deltaTime: number) {
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f6003bdc-c4b1-4cd7-b2bf-27cac20ce0a0",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,33 @@
import { _decorator, Component, instantiate, Node } from 'cc';
import { PuzzleSprite } from '../puzzle/PuzzleSprite';
const { ccclass, property, executeInEditMode} = _decorator;
@ccclass('TestPuzzle')
@executeInEditMode(true)
export class TestPuzzle extends Component {
@property({type:Node})
public piece:Node;
start(): void {
if (!this.piece)
return
this.node.removeAllChildren();
for (let c = 0; c < 10; c++) {
for (let r = 0; r < 6; r++) {
let idx = c + r * 10;
if (idx < this.node.children.length)
continue;
let node = instantiate(this.piece);
this.node.addChild(node)
// let node = this.node.children[idx]
node.setPosition(c * 80, (6 - r) * 80, 0)
node.getComponent(PuzzleSprite).columnMax = 10
node.getComponent(PuzzleSprite).rowMax = 6
node.getComponent(PuzzleSprite).column = c + 1
node.getComponent(PuzzleSprite).row = r + 1
}
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "001cf388-4bdf-4143-8ecf-bd9a2b618966",
"files": [],
"subMetas": {},
"userData": {}
}