因為最近開發乙個laya3d小遊戲,有需要用到shader的地方,最後發現網上找的laya shader因為laya api的變動而沒能達到自己想要的效果,所以決定整理一下:
snowmaterial.ts
export default class snowmaterial extends laya.material {
static diffusetexture = laya.shader3d.propertynametoid("u_texture");
public readonly main_tex: number = laya.shader3d.propertynametoid("u_maintex");
public readonly noise_tex: number = laya.shader3d.propertynametoid("u_noisetex");
public readonly time:number = laya.shader3d.propertynametoid("u_time");
constructor() {
super();
var vs: string = `
#include "lighting.glsl";
attribute vec4 a_position;
attribute vec2 a_textcoord;
uniform mat4 u_worldmat;
uniform mat4 u_mvpmatrix;
varying vec2 v_textcoord;
void main()
{v_textcoord = a_textcoord;
gl_position =
LayaAir飛機大戰 4
新增遊戲資源並快取動畫.快取子彈動畫 laya.animation.createframes war bullet1.png bullet1 fly 增加子彈射擊的基礎屬性.射擊型別 public shoottype number 0 射擊間隔 public shootinterval number...
LayaAir飛機大戰 6
增加難度條件,實現積分達到條件後進入新關卡的邏輯 onloop void 檢測碰撞 for var i number this.rolebox.numchildren 1 i 1 i 獲取角色物件1 var role1 role this.rolebox.getchildat i as role i...
LayaAir之製作迷宮
最近看到一篇部落格,也是製作迷宮的,我仔細看了一下,裡面涉及乙個演算法 並查集 不相交集合 沒有聽過,就打算練習一下,由於最近又在使用layaair,就打算用它來寫。先看我之前看的那兩篇文章 鏈結1,鏈結2 我使用的是layaair2.2.0beta4 效果圖 新建乙個指令碼,指令碼繼承laya.s...