gl-spikes3d

WebJar for gl-spikes3d

Лицензия

Лицензия

MIT
Группа

Группа

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

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

gl-spikes3d
Последняя версия

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

1.0.10
Дата

Дата

Тип

Тип

jar
Описание

Описание

gl-spikes3d
WebJar for gl-spikes3d
Ссылка на сайт

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

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

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

https://github.com/gl-vis/gl-spikes3d

Скачать gl-spikes3d

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

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

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.webjars.npm : gl-buffer jar [2.1.2,3)
org.webjars.npm : gl-shader jar [4.2.1,5)
org.webjars.npm : gl-vao jar [1.3.0,2)
org.webjars.npm : glslify jar [7.0.0,8)

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

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

gl-spikes3d

Draws axis spikes compatible with gl-axes3d. This can be useful to illustrate selections or specific points in a point cloud

Example

Try it out here

var shell = require("gl-now")({ clearColor: [0,0,0,0], tickRate: 5 })
var camera = require("game-shell-orbit-camera")(shell)
var mat4 = require("gl-matrix").mat4
var createAxes = require("gl-axes")
var createSpikes = require("gl-spikes")

//Bounds on function to plot
var bounds = [[-1,-1,-1], [1,1,1]]

//camera.lookAt([-15,20,-15], [0,0,0], [0, 1, 0])
camera.lookAt([2, 2, 2], [0,0,0], [0,1,0])

//State variables
var axes, spikes

shell.on("gl-init", function() {
  var gl = shell.gl
  
  axes = createAxes(gl, {
    bounds: bounds,
    tickSpacing: [0.1,0.1,0.1],
    textSize: 0.05
  })

  spikes = createSpikes(gl, {
    bounds: bounds,
    colors: [[1,0,0,1], [0,1,0,1], [0,0,1,1]],
    position: [0,0,0]
  })
})

shell.on("gl-render", function() {
  var gl = shell.gl
  gl.enable(gl.DEPTH_TEST)

  //Compute camera parameters
  var cameraParameters = {
    view: camera.view(),
    projection: mat4.perspective(
        mat4.create(),
        Math.PI/4.0,
        shell.width/shell.height,
        0.1,
        1000.0)
  }


  //Update spike position
  var t = 0.001*Date.now()
  spikes.position = [Math.cos(t), Math.sin(t), Math.cos(2*t+0.1)]

  //Draw objects
  axes.draw(cameraParameters)
  spikes.draw(cameraParameters)
})

Install

npm install gl-spikes

API

var spikes = require('gl-spikes')(gl, options)

Creates a new spike object.

  • gl is a WebGL context
  • options is a list of optional parameters which are passed along

Methods

spikes.draw(camera)

Draws the axis spikes using the given camera coordinates.

  • camera.model is the model matrix for the camera
  • camera.view is the view matrix
  • camera.projection is the projection matrix

spikes.update(options)

Updates the parameters of the axes spikes. options is an object with the following properties:

  • position the position of the spike ball in data coordinates
  • bounds the bounds of the axes object
  • colors an array of 3 length 4 arrays encoding the RGBA colors for the spikes along the x/y/z directions
  • enabled an array of 3 flags which if set turns on or off the spikes
  • drawSides an array of 3 flag which if set turns on or off the projected spikes in each data plane
  • lineWidth an array of 3 numbers giving the thickness of the spikes for each axis

spikes.dispose()

Destroys the spike object and releases all associated resources.

Credits

(c) 2014 Mikola Lysenko. MIT License

org.webjars.npm

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

Версия
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6