• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript painterState.getEffect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中shared-utils/painterState.getEffect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getEffect函数的具体用法?TypeScript getEffect怎么用?TypeScript getEffect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getEffect函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getBlurByAlphaEffect

export function getBlurByAlphaEffect(
	painter: Painter,
	id: string,
	{
		strength,
		size,
		layerOpts,
		startFrame: startLayer,
		strengthOffset = 0,
		blurRatioVertical = 1,
		scaleFactor = 0.6,
	}: BlurOpts,
) {
	const passData: any[] = []

	while (strength >= 1 / blurRatioVertical) {
		passData.push({
			strength,
			direction: 0,
			source: '0',
		})
		passData.push({
			strength: strength * blurRatioVertical,
			direction: 1,
			source: '0',
		})
		strength *= scaleFactor
	}

	if (startLayer) {
		passData[0].source = () => startLayer.image()
	}

	return getEffect(painter, id).update({
		...layerOpts,
		frag,
		drawSettings: {
			disable: [painter.gl.DEPTH_TEST],
		},
		uniforms: passData.map(data => ({
			...data,
			blurRatioVertical,
			strengthOffset,
			size: size || (() => [painter.gl.canvas.width, painter.gl.canvas.height]),
		})),
	})
}
开发者ID:trivial-space,项目名称:playground,代码行数:47,代码来源:blur.ts


示例2: makeClear

		view: () => state.viewPort.camera.viewMat,
		projection: () => state.viewPort.camera.projectionMat,
	},
	drawSettings: {
		enable: [gl.DEPTH_TEST],
		clearBits: makeClear(gl, 'color', 'depth'),
	},
})

const bufferSpec: TextureData = { type: 'FLOAT' }
export const scene = getFrame(painter, 'scene').update({
	layers: sceneLayer,
	bufferStructure: [bufferSpec, bufferSpec, bufferSpec, bufferSpec],
})

const lightLayer = getEffect(painter, 'light').update({
	frag: lightFrag,
	uniforms: {
		eyePosition: () => state.viewPort.camera.position,
		lightMat: () => state.scene.lightTransforms[0],
		view: () => state.viewPort.camera.viewMat,
		tex: () => texture.image(),
		positions: scene.image(0),
		normals: scene.image(1),
		uvs: scene.image(2),
		colors: scene.image(3),
	},
	drawSettings: {
		enable: [gl.BLEND],
		clearBits: makeClear(gl, 'color'),
	},
开发者ID:trivial-space,项目名称:playground,代码行数:31,代码来源:renderer.ts


示例3: getFrame

	getSketch,
} from 'shared-utils/painterState'
import { makeClear } from 'tvs-painter/dist/utils/context'
import { plane } from 'tvs-painter/dist/utils/geometry/plane'
import { events, gl, paint, painter } from './context'
import base from './glsl/base.frag'
import planeFrag from './glsl/plane-material.frag'
import planeVert from './glsl/plane-material.vert'

// ===== gof layers =====

const paintFrame = getFrame(painter, 'paint')

const bufferSize = 256

const effect = getEffect(painter, 'layer').update({
	frag: base,
	uniforms: {
		size: bufferSize,
		paint: () => paintFrame.image(),
		previous: '0',
	},
})

export const automaton = getFrame(painter, 'automaton').update({
	layers: effect,
	selfReferencing: true,
	width: bufferSize,
	height: bufferSize,
	bufferStructure: [
		{
开发者ID:trivial-space,项目名称:playground,代码行数:31,代码来源:renderer.ts


示例4: getEffect

import { getEffect } from 'shared-utils/painterState'
import { painter } from './context'

// ===== layers =====

export const noise = getEffect(painter, 'noise')

export const toNormal = getEffect(painter, 'toNormal')
开发者ID:trivial-space,项目名称:playground,代码行数:8,代码来源:index.ts


示例5: getLayer

})

// ===== layers =====

const points = getLayer(painter, 'points').update({
	sketches: [pointsSketch],
	uniforms: { size: () => [canvas.width, canvas.height] },
	drawSettings: {
		clearColor: [0, 0, 0, 1],
		clearBits: gl.COLOR_BUFFER_BIT,
		enable: [gl.BLEND],
		blendFunc: [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA],
	},
})

const currentTriple = getEffect(painter, 'sides').update({
	frag: sideFrag,
})

const current = getFrame(painter, 'current').update({
	layers: [points, currentTriple],
})

const blend = getEffect(painter, 'blend').update({
	frag: blendFrag,
	uniforms: {
		previous: '0',
		current: () => current.image(),
	},
})
开发者ID:trivial-space,项目名称:playground,代码行数:30,代码来源:index.ts



注:本文中的shared-utils/painterState.getEffect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript painterState.getForm函数代码示例发布时间:2022-05-25
下一篇:
TypeScript painterState.get函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap