Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gl-skydome-sun

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-skydome-sun

Draws a skydome with a sun into a 3D scene.

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gl-skydome-sun

Draws a skydome with a sun into a 3D scene. This project is a fork of the module gl-skybox. Demo: http://erkaman.github.io/gl-skydome-sun/

text

NPM

Install

npm install gl-skydome-sun

API

var createSkydome = require('gl-skydome-sun')

Constructor

var skydome = createSkydome(gl)

Takes a WebGL context gl. Returns an object skybox ready for rendering into your scene.

Methods

skydome.draw(camera[, opts])

Draws the skydome and sun into your scene.

Takes a camera object that defines the view and projection matrices:

{
  view: gl-mat4 matrix,
  projection: gl-mat4 matrix
}

This function will take care of centering the skydome and projection near/far values for you, so there is no need to make a view/projection matrix specifically for rendering the skydome. It will also disable depth buffer read/writes and then restore them to whatever you had them set to before returning, so there's no need to handle that yourself.

The optional arguments are

  • opts.lowerColor the color of the lower hemisphere of the skydome.
  • opts.upperColor the color of the upper hemisphere of the skydome.
  • opts.sunDirection A unit vector that describes the position of the sun on the skydome. Note that it is assumed that this is a unit vector!
  • opts.sunColor The color of the sun.
  • opts.sunSize The size of the sun. Should be in the range [0,500].
  • opts.renderSun Whether or not to render the sun. Default value is true
  • opts.doDithering Enables dithering. Dithering can be used to reduce banding artifacts in the rendered sky(the artifacts are mostly visible when the color of the sky is rather dark). Default value is true.
  • opts.ditheringAmmount The ammount of dithering to apply to every fragment of the rendered sky. Default value is 0.005.
skydome.constructViewProjection(camera)

Given a camera object, returns the view/projection matrices that is used to render the skydome(see the documentation of skydome.draw for more details). This function returns an object on the form

{
  view: gl-mat4 matrix,
  projection: gl-mat4 matrix
}

Keywords

FAQs

Package last updated on 18 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc