glsl-face-normal

WebJar for glsl-face-normal

Лицензия

Лицензия

MIT
Категории

Категории

ORM Данные
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

glsl-face-normal
Последняя версия

Последняя версия

1.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

glsl-face-normal
WebJar for glsl-face-normal
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/glslify/glsl-face-normal

Скачать glsl-face-normal

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/glsl-face-normal/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>glsl-face-normal</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/glsl-face-normal/
implementation 'org.webjars.npm:glsl-face-normal:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/glsl-face-normal/
implementation ("org.webjars.npm:glsl-face-normal:1.0.2")
'org.webjars.npm:glsl-face-normal:jar:1.0.2'
<dependency org="org.webjars.npm" name="glsl-face-normal" rev="1.0.2">
  <artifact name="glsl-face-normal" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='glsl-face-normal', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "glsl-face-normal" % "1.0.2"
[org.webjars.npm/glsl-face-normal "1.0.2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

glsl-face-normal

stable

demo-image

(click for demo)

Approximates face normals in the fragment shader for flat shading from the position in camera space.

Note: You need to enable GL_OES_standard_derivatives.

Fragment:

#extension GL_OES_standard_derivatives : enable
varying vec3 vViewPos;

#pragma glslify: faceNormal = require('glsl-face-normal')

void main() {
  vec3 normal = faceNormal(vViewPos);
  //... lighting
}

Vertex:

varying vec3 vViewPos;

void main() {
  vec4 pos = vec4(position, 1.0);
  vec4 mpos = modelViewMatrix * pos;
  gl_Position = projectionMatrix * mpos;
  vViewPos = -mpos.xyz;
}

Usage

NPM

vec3 normal = faceNormal(vec3 pos)

Approximates the face normal from the given pos, which is typically the position in camera-space.

For better precision, you can use the eye relative position instead.

License

MIT. See LICENSE.md for details.

org.webjars.npm

Версии библиотеки

Версия
1.0.2