Code Monkey home page Code Monkey logo

webvr-starter-kit's Introduction

Web VR Starter Kit

Web VR Starter Kit is a Javascript library for easily creating virtual reality content and making it available in web browsers on a range of devices. The library includes a simplified API for creating an manipulating 3D objects.

Examples

  • Panorama - Loading a spherical panoramic photo
  • Animation - Simple animation, moving and rotating objects
  • Sky - A realistic daytime sky with movable sun and lighting
  • Sound - Audio sources in 3D space, triggered by looking at objects
  • Video - A video playing on a flat surface.
  • Near and Far - Fire events when an object moves close to or far away from the viewer
  • 3D Panorama - Loading a stereoscopic spherical panoramic photo
  • 3D Spherical Video - A stereoscopic spherical video
  • Text - 2D text in 3D space

Getting Started

To create a virtual reality scene, include the WebVR Starter Kit JavaScript file as a script tag in a webpage. The script will bootstrap an empty scene with controls for display and view-tracking options, depending on the hardware available.

WebVR requires a browser with WebGL support. The following device configurations are supported for display and head/view tracking:

  • Oculus Rift - requires Firefox Nightly or WebVR build of Chromium
  • Google Cardboard - Device orientation tracking; split-screen rendering a view for each eye.
  • Mobile phone/tablet - single view, control view with device orientation tracking or touch/drag
  • Desktop browser - single view, control view by dragging with mouse

Set up

The quickest way to get started is to load the empty JS Bin template and start writing commands in the JavaScript panel. As you type, the output panel will automatically reload every time you make a change. You can pop the output panel out into its own window to view in full screen or on an Oculus Rift (if available), or you can load the output page on a mobile device.

Alternatively, you can start with a blank web page hosted on your own server. Include the following script element anywhere in the page.

<script src="//povdocs.github.io/webvr-starter-kit/build/vr.js"></script>

Create another script element containing the JavaScript commands that describe your scene. You can either include the script "inline" right in the same web page, or you can refer to an external JavaScript file. Just make sure this script element is placed after the one loading "vr.js".

<script>
	VR.floor(); //make a floor
</script>

Creating Objects

Loading Media

There are a few different ways that you can load media as part of your VR scene. The panorama and image objects take the URL of an image file. The sound object takes an array of URLs of audio files, and the video object takes an array of URLs of video files. There is a library of pre-defined materials (e.g. grass, stone, metal, wood), and you can also specify your own images to use as texture maps.

Texture maps for pre-defined materials are hosted as part of the WebVR Starter Kit, but your own media files need to be hosted elsewhere. You can use your own web server if you have one, but it needs to be configured to use Cross-Origin Resource Sharing headers, which can be tricky to set up.

There are some free services you can use to host your media with the correct server settings.

imgur.com

If you have an image you want to use, you can upload it to imgur.com. Once the image is uploaded, follow the link to share it and look for the "direct" image URL. That will link directly to the png or jpg file, and it's the URL to use in your code.

You can also use any image that's already hosted on imgur, but check the copyright terms on the site and on the particular image.

Dropbox

If you have a Dropbox account, you can copy your media files into your "Public" folder. Log into Dropbox through their website and browse to the Public folder. Click on the file you want to use for a prompt to view the public URL of that file. Unlike imgur, Dropbox can host audio and video files.

Internet Archive

todo: archive.org

Using three.js

The simplified API is a wrapper for three.js, a JavaScript library for creating 3D scenes using WebGL. three.js is more powerful than the WebVR Starter Kit API, but more difficult to use. If you prefer, you can use three.js directly to build your scene, but you will not be able to use the wrapper objects on any objects you create with three.js.

If you prefer to use the simplified API for part of your code and use three.js for a limited set of advanced operations, each object created has a .object property that points to its three.js object.

var box = VR.box();
console.log(box.object instanceof THREE.Mesh); // true

API Reference

Objects

todo: describe common options and methods for all objects

Options
  • name
  • material
  • color

VR.box()

Create a cube.

Options

No options.

VR.cylinder()

Create a cylinder. You can also create a cone by change the radius at one end to zero.

Options
  • radiusTop — Radius of the cylinder at the top. Default: 0.5
  • radiusBottom — Radius of the cylinder at the bottom. Default: 0.5
  • height — Height of the cylinder. Default: 1
  • radiusSegments — Number of segmented faces around the circumference of the cylinder. Default: 16
  • heightSegments — Number of rows of faces along the height of the cylinder. Default: 1
  • openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default: false (capped)

VR.sphere()

Create a sphere. Parts of spheres or slices can be created by specifying different values for phiStart, phiLength, thetaStart or thetaLength.

Options
  • radius — sphere radius. Default: 0.5
  • widthSegments — number of horizontal segments. (Minimum value is 3). Default: 16
  • heightSegments — number of vertical segments. (Minimum value is 2). Default: 12
  • phiStart — specify horizontal starting angle. Default: 0
  • phiLength — specify horizontal sweep angle size. Default: PI * 2
  • thetaStart — specify vertical starting angle. Default: 0
  • thetaLength — specify vertical sweep angle size. Default: PI

VR.torus()

Create a torus (like a donut).

Options
  • radius — Default: 0.5
  • tube — Diameter of the tube. Default: 0.125 (i.e. 1/8th)
  • radialSegments — Default: 12
  • tubularSegments — Default: 16
  • arc — Central angle, or how much around the center point the torus is filled in. Default: PI * 2

VR.floor()

Options
  • radius — Radius of the circle. Default: 100
  • segments — Number of segments. Default: 16

VR.image()

A plane displaying an image.

Options
  • src - A url pointing to the image file

VR.video()

A plane displaying a video.

Options
  • src - A url or array of urls pointing to the video file(s). Provide multiple sources for different formats to support all browsers.
Methods and Properties

Video objects have some unique methods and properties for inspecting and controlling the state of the video.

play()

Play the video.

pause()

Pause the video.

canPlayType(type)

Pass a mime type (e.g. "video/webm") to determine whether the video can play a given format.

currentTime

The current time within the video (in seconds) of the play head. (Read only)

duration

The total duration of the video in seconds. This value is not known until the video starts loading. (Read only)

volume

The volume level of the video. It can be set to any value between 0 and 1.

height

The height in pixels of the video source. This value is not known until the video starts loading. (Read only)

width

The width in pixels of the video source. This value is not known until the video starts loading. (Read only)

paused

A boolean value that reports whether the video is paused (true) or playing (false). (Read only)

Notes on compatibility

Safari and Internet Explorer cannot display cross-origin videos, i.e. files served from a different web server than the web page. So you must host the web page on your own server if you want to use video on all browsers. JSBin will not work.

Mobile Safari is only capable of playing one video at a time, and only on iPad.

VR.panorama()

A very large sphere with an image displayed on the inside. This is useful for loading an image to be used as a sky or a landscape. It works best if most objects in the photo are far away.

Spherical photos can be taken with the Android Camera or a similar app on an iPhone. They can also be made manually.

Stereoscopic (3D) panoramas can be displayed by setting the stereo option, if the left and right eye views are included side-by-side or vertically in the same image file.

Options
  • src - A url pointing to the image file
  • stereo - a string, either "horizontal" or "vertical" (optional).

VR.text()

Creates two-dimensional text. Observes new-line characters.

Options
  • text - a string representing the text to render
  • font - a string, the font style, size and family
  • textAlign - 'left', 'right', 'center', 'justify', 'start' or 'end'
  • textBaseline - 'top', 'hanging', 'middle', 'alphabetic', 'ideographic' or 'bottom'
  • direction - 'ltr' (left to right) or 'rtl' (right to left)
  • fillStyle - same as the 2d canvas property
  • wrap - the maximum width of the text object in meters. Any text longer than this will wrap to the next line.
  • resolution - the number of "pixels" equivalent to 1 meter in 3D space. Making this number higher will increase the fidelity of the text but will also require making the font size proportionally larger. (default is 256)
Properties
width

The width of the object containing the text. This will depend on the length of the text, the font size and the wrap setting.

height

The height of the object containing the text. This will depend on the length of the text, the number of lines and the font size.

VR.empty()

An empty object, not displayed. Can be used to group other objects.

Options

No options.

Object Methods

The following methods are available on all object types for manipulating the shape, size, material, orientation, position and any other aspects of that object.

All methods (except for ones that create child objects), return the object itself, so methods can be chained:

// create a box, move it up 2 meters, and set the material to "wood"
VR.box().moveUp(2).setMaterial('wood');

hide()

Make the object invisible. All objects are visible by default.

show()

Make the object visible, if it was previously made invisible.

moveTo(x, y, z)

moveX(distance)

moveY(distance)

moveZ(distance)

moveUp(distance)

rotateX(radians)

rotateY(radians)

rotateZ(radians)

setMaterial(material)

setScale(x, y, z)

Child Objects

Objects can be created as "child" of a parent object. This is useful for creating more complex objects out of the simple primitives or for moving groups of objects together. All the object creation methods listed above on the main VR object are available on every other object created.

The position, rotation and size of child objects will be re

Example

The "empty" object type is useful as an invisible parent object below which other objects can be grouped.

Object Properties

  • parent
  • distance
  • visible
  • inView
  • object
  • position
  • scale
  • rotation
  • quaternion
  • material

Utility Methods

VR.on(event, callback)

Certain types of "events" are available to notify your code when interesting things happen, such as the user looking at an object or shaking the phone. This method provides a way to specify the event type and a "callback function" to be run when the event occurs.

Events are listed below. Not all events are available on all devices.

Parameters
  • event - A string representing the name of the event type to listen for
  • callback - A function to be run when the event is triggered. The callback function may be given certain parameters, depending on the type of event
Events
  • lookat - The viewer looked directly at an object. There is one parameter, target: the THREE.js object in question
  • lookaway - The viewer looked away from an object. There is one parameter, target: the THREE.js object in question
  • shake - The user shook the device. Mostly only works on mobile devices. Does not work on head-mounted displays.
  • fullscreenchange - The view has either entered or exited full screen mode.
  • devicechange - The device used to display and track orientation has been detected. There is one parameter, mode: a string representing the type of device. "devicemotion" for a mobile phone/tablet, "hmd" for a head-mounted display like the Oculus Rift. If there is no orientation device detected, like on a desktop computer without a head-mounted display, this event will not fire.
Example

When the user shakes the device, make the box invisible. Shake it again to bring it back.

var box = VR.box();
VR.on('shake', function () {
    if (box.visble) {
        box.hide();
    } else {
        box.show();
    }
});

VR.off()

Prevent any previously registered event callbacks from running in the future.

Parameters
  • event - A string representing the name of the event type.
  • callback - A callback function previously registered with VR.on() with the same callback type. This callback will no longer be run for this method.

VR.animate()

This method can be passed a callback function, which is run every time a new frame is rendered. Objects in the scene can be animated by changing their position, scale or rotation according to how much time has passed since the last update.

Parameters
  • callback - A function to be run on every frame. Receives two arguments: delta, the number of seconds since the last frame, and time, the current time in seconds
Example

Create a box and make it rotate, one full rotation per second.

var box = VR.box();
VR.animate(function (delta) {
    box.rotateY(delta * Math.PI 2);
});

VR.end()

Stop any or all animation callbacks from running.

Parameters
  • callback - The same function passed to VR.animate that you want to stop from running. This parameter is optional. If no function is passed, all animations will be stopped.

VR.vibrate()

Cause the device to vibrate, if the browser and hardware support it. This is most likely to be available on mobile devices running Android with Chrome or Firefox. If vibration is not supported, nothing will happen.

Parameters
  • pattern - A pattern of vibration and pause intervals. This can either be a number, representing the duration of a single vibration in milliseconds, or an array of numbers representing alternating vibrations and pauses in milliseconds.
Example

When the user looks at the box, vibrate once for one quarter of a second. When the user looks at the sphere, vibrate 'SOS' in Morse code.

var box = VR.box().moveX(-2);
var sphere = VR.sphere().moveX(2);
VR.on('lookat', function (target) {
    if (target === box.object) {
        // 1/4 of 1000 milliseconds = 250 milliseconds
        VR.vibrate(250);
    } else if (target === sphere.object) {
        VR.vibrate([100, 30, 100, 30, 100, 200, 200, 30, 200, 30, 200, 200, 100, 30, 100, 30, 100]);
    }
});

VR.zeroSensor()

Reset the rotation of the viewer so that whichever direction they are looking at the time VR.zeroSensor() is called gets set back to the original "zero" direction they were facing when the web page loaded.

Properties

The following properties are available on the global VR object.

VR.body

A VRObject representing the viewer. This object can be manipulated like any other object, and child objects can be attached to it, like a vehicle or tools. The body object can be moved around the scene to give the viewer different perspectives.

The body starts out 1.5 meters high and 4 meters back from the center point (0, 0, 0) of the scene.

Warning: Be careful about animating movement of the body, as it may cause motion sickness. It's best to constrain movement to the direction the viewer is looking. Any movement backwards or to the side should be slow. Starting and stopping of movement should be abrupt and the speed should remain constant, as acceleration in any direction is known to cause motion sickness.

VR.camera

A VRObject representing the camera. The camera is a child object of the body. It's best not to move, rotate or scale the camera. Instead, move the body.

Images or objects can be scaled down and attached to the front of the camera to act as a "heads up display."

VR.canvas

The HTML canvas element to which the scene is being rendered.

VR.materials

An object on which all material-related functions and properties are attached:

  • VR.materials.library - an array of strings representing the names of built-in material presets
  • VR.materials.textures - an array of THREE.Texture objects used by built-in materials

VR.scene

The THREE.Scene object that is the parent of all other three.js objects.

Materials

  • asphalt
  • brick-tiles
  • bricks
  • checkerboard
  • grass
  • metal-floor
  • metal
  • stone
  • tiles
  • weathered-wood
  • wood

License

  • Original code is made avalable under MIT License, Copyright (c) 2015 American Documentary Inc.
  • Texture images are made available under their respective licenses.

Author

Code, concept and design by Brian Chirls, POV Digital Technology Fellow

webvr-starter-kit's People

Contributors

brianchirls avatar salim523 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webvr-starter-kit's Issues

Can not disable all movements

Hello,
I use webVR to play video 360 but I also wan't use it for normal video.
How can I disable movement (head and finger) ?
There is a vr.video mode to display flat video ?
Best regards,

VR.person

Get a low-poly model of a person that people can place in.

  • What do about gender? color?
  • Solve all problems of diversity in society.

Using three.js functions with camera.

So I'm trying to get the camera towards where I am looking at. There is a method that easily allows me to do this, built into three.js:

VR.camera.object.translateZ(delta);

This works fine when I put it in the animate function, but obviously I am going backwards. When I try to make delta negative the frames start to go strange and the whole thing breaks.

VR.camera.object.translateZ(-delta);

I know that the camera object isn't really meant to be manipulated but this is really strange.

Add a link to an object in the scene

Hi,
I'm trying to figure out the best way to add a link on one of the objects in the scene. Should I be using document.createElement, or is there a better way? And in case createElement is the way to go, how do I tie it to an object that I have created using the webvr-engine?

Best Regards
Simon

Using Images

could you provide an example code for using jsBin to pull an image from the internet and use it in a VR.image object or a VR.video object

WS-2019-0032 Medium Severity Vulnerability detected by WhiteSource

WS-2019-0032 - Medium Severity Vulnerability

Vulnerable Library - js-yaml-3.7.0.tgz

YAML 1.2 parser and serializer

path: /tmp/git/webvr-starter-kit/node_modules/js-yaml/package.json

Library home page: https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz

Dependency Hierarchy:

  • css-loader-0.22.0.tgz (Root Library)
    • cssnano-3.10.0.tgz
      • postcss-svgo-2.1.6.tgz
        • svgo-0.7.2.tgz
          • js-yaml-3.7.0.tgz (Vulnerable Library)

Vulnerability Details

Versions js-yaml prior to 3.13.0 are vulnerable to Denial of Service. By parsing a carefully-crafted YAML file, the node process stalls and may exhaust system resources leading to a Denial of Service.

Publish Date: 2019-03-26

URL: WS-2019-0032

CVSS 2 Score Details (5.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://www.npmjs.com/advisories/788/versions

Release Date: 2019-03-26

Fix Resolution: 3.13.0


Step up your Open Source Security Game with WhiteSource here

Screen is blank

When I try to open panorama example with my mi4i the whole screen is show only black color.

Transparent images

Hi,
I'm having a problem that some of the transparent images that I add to the scene are "flickering" between transparency and opaque when I look around in the scene.

Its visible on the print icon and the speach bubbles in this scene:
http://www.migrantjourneys.com/Intro/

Any advice would be appreciated!

Thanks.

WS-2018-0210 Low Severity Vulnerability detected by WhiteSource

WS-2018-0210 - Low Severity Vulnerability

Vulnerable Libraries - lodash-1.0.2.tgz, lodash-2.4.2.tgz

lodash-1.0.2.tgz

A utility library delivering consistency, customization, performance, and extras.

path: /tmp/git/webvr-starter-kit/node_modules/lodash/package.json

Library home page: http://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz

Dependency Hierarchy:

  • gulp-3.9.1.tgz (Root Library)
    • vinyl-fs-0.3.14.tgz
      • glob-watcher-0.0.6.tgz
        • gaze-0.5.2.tgz
          • globule-0.1.0.tgz
            • lodash-1.0.2.tgz (Vulnerable Library)
lodash-2.4.2.tgz

A utility library delivering consistency, customization, performance, & extras.

path: /tmp/git/webvr-starter-kit/node_modules/rcloader/node_modules/lodash/package.json

Library home page: http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz

Dependency Hierarchy:

  • jshint-loader-0.8.4.tgz (Root Library)
    • rcloader-0.1.2.tgz
      • lodash-2.4.2.tgz (Vulnerable Library)

Vulnerability Details

In the node_module "lodash" before version 4.17.11 the functions merge, mergeWith, and defaultsDeep can be tricked into adding or modifying properties of the Object prototype. These properties will be present on all objects.

Publish Date: 2018-11-25

URL: WS-2018-0210

CVSS 2 Score Details (3.5)

Base Score Metrics not available

Suggested Fix

Type: Change files

Origin: lodash/lodash@90e6199

Release Date: 2018-08-31

Fix Resolution: Replace or update the following files: lodash.js, test.js


Step up your Open Source Security Game with WhiteSource here

Installing the starter kit for development

Hi,
First of all, thanks for this project, it is amazing!

I want to contribute to the project so I cloned the repo, npm and bower installed dependencies and run gulp. It throws lots of errors and warnings. For example

ERROR in ./src/objects/video.js
jshint results in errors
  Incompatible values for the 'strict' and 'globalstrict' linting options. (7% scanned). @ line 20 char 54
    undefined

How can I sort this out? Is it a problem on my environment or is something you didn't push yet.

Thanks again!

CVE-2016-10540 High Severity Vulnerability detected by WhiteSource

CVE-2016-10540 - High Severity Vulnerability

Vulnerable Libraries - minimatch-0.2.14.tgz, minimatch-2.0.10.tgz

minimatch-0.2.14.tgz

a glob matcher in javascript

path: /tmp/git/webvr-starter-kit/node_modules/globule/node_modules/minimatch/package.json

Library home page: http://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz

Dependency Hierarchy:

  • gulp-3.9.1.tgz (Root Library)
    • vinyl-fs-0.3.14.tgz
      • glob-watcher-0.0.6.tgz
        • gaze-0.5.2.tgz
          • globule-0.1.0.tgz
            • minimatch-0.2.14.tgz (Vulnerable Library)
minimatch-2.0.10.tgz

a glob matcher in javascript

path: /tmp/git/webvr-starter-kit/node_modules/minimatch/package.json

Library home page: http://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz

Dependency Hierarchy:

  • gulp-3.9.1.tgz (Root Library)
    • vinyl-fs-0.3.14.tgz
      • glob-stream-3.1.18.tgz
        • minimatch-2.0.10.tgz (Vulnerable Library)

Vulnerability Details

Minimatch is a minimal matching utility that works by converting glob expressions into JavaScript RegExp objects. The primary function, minimatch(path, pattern) in Minimatch 3.0.1 and earlier is vulnerable to ReDoS in the pattern parameter.

Publish Date: 2018-05-31

URL: CVE-2016-10540

CVSS 3 Score Details (7.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://nodesecurity.io/advisories/118

Release Date: 2016-06-20

Fix Resolution: Update to version 3.0.2 or later.


Step up your Open Source Security Game with WhiteSource here

Text rendered center aligned if text width is shorter than the 'wrap'

Even thought textAlign is set to left, a string if shorter than 1 full line, is rendered center-aligned.

The attached image is how you get if declared as below:

var tempRender = container.text({ wrap: textWrapFactor, font: fontSize + 'pt Roboto', textAlign: 'left', fillStyle : '#333333', text : str });

screen shot 2016-01-22 at 9 21 12 pm

Interference on the Scene from other HTML Elements

I am developing a webpage which utilizes a User Interface(HUDs, divs, spans, paragrpahs, text menus, drop downs, etc...) as an overlay on the scene, which are written in HTML. When interacting with the UI elements, the scene is being effected. (IE: mousedown on a menu/moving a dialog window(jquery), results in teh scene's camera being manipulated as well!)
How can seperate the scene/canvas from the UI/overlay??

thank you in advance! :D

WS-2017-0330 Medium Severity Vulnerability detected by WhiteSource

WS-2017-0330 - Medium Severity Vulnerability

Vulnerable Library - mime-1.3.6.tgz

A comprehensive library for mime-type mapping

path: /tmp/git/webvr-starter-kit/node_modules/mime/package.json

Library home page: https://registry.npmjs.org/mime/-/mime-1.3.6.tgz

Dependency Hierarchy:

  • url-loader-0.5.9.tgz (Root Library)
    • mime-1.3.6.tgz (Vulnerable Library)

Vulnerability Details

Affected version of mime (1.0.0 throw 1.4.0 and 2.0.0 throw 2.0.2), are vulnerable to regular expression denial of service.

Publish Date: 2017-09-27

URL: WS-2017-0330

CVSS 2 Score Details (5.0)

Base Score Metrics not available


Step up your Open Source Security Game with WhiteSource here

CVE-2018-16487 High Severity Vulnerability detected by WhiteSource

CVE-2018-16487 - High Severity Vulnerability

Vulnerable Libraries - lodash-1.0.2.tgz, lodash-2.4.2.tgz

lodash-1.0.2.tgz

A utility library delivering consistency, customization, performance, and extras.

path: /tmp/git/webvr-starter-kit/node_modules/lodash/package.json

Library home page: http://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz

Dependency Hierarchy:

  • gulp-3.9.1.tgz (Root Library)
    • vinyl-fs-0.3.14.tgz
      • glob-watcher-0.0.6.tgz
        • gaze-0.5.2.tgz
          • globule-0.1.0.tgz
            • lodash-1.0.2.tgz (Vulnerable Library)
lodash-2.4.2.tgz

A utility library delivering consistency, customization, performance, & extras.

path: /tmp/git/webvr-starter-kit/node_modules/rcloader/node_modules/lodash/package.json

Library home page: http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz

Dependency Hierarchy:

  • jshint-loader-0.8.4.tgz (Root Library)
    • rcloader-0.1.2.tgz
      • lodash-2.4.2.tgz (Vulnerable Library)

Vulnerability Details

A prototype pollution vulnerability was found in lodash <4.17.11 where the functions merge, mergeWith, and defaultsDeep can be tricked into adding or modifying properties of Object.prototype.

Publish Date: 2019-02-01

URL: CVE-2018-16487

CVSS 3 Score Details (9.8)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: High
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-16487

Release Date: 2019-02-01

Fix Resolution: 4.17.11


Step up your Open Source Security Game with WhiteSource here

How to check current rotation of an object

Hi Brian!
Trying to make an object 'flutter in the wind' by rotating it back and forth along x-axis. Right now I count amount of calls to rotateX and swap direction of the rotation based on that. But I noticed it is not consistent and will instead need to use the actual rotation of the object as deciding factor for when to swap direction. So my question is how I read out the current rotation of the object.

Thanks
Simon

CVE-2018-3721 Medium Severity Vulnerability detected by WhiteSource

CVE-2018-3721 - Medium Severity Vulnerability

Vulnerable Libraries - lodash-1.0.2.tgz, lodash-2.4.2.tgz

lodash-1.0.2.tgz

A utility library delivering consistency, customization, performance, and extras.

path: /tmp/git/webvr-starter-kit/node_modules/lodash/package.json

Library home page: http://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz

Dependency Hierarchy:

  • gulp-3.9.1.tgz (Root Library)
    • vinyl-fs-0.3.14.tgz
      • glob-watcher-0.0.6.tgz
        • gaze-0.5.2.tgz
          • globule-0.1.0.tgz
            • lodash-1.0.2.tgz (Vulnerable Library)
lodash-2.4.2.tgz

A utility library delivering consistency, customization, performance, & extras.

path: /tmp/git/webvr-starter-kit/node_modules/rcloader/node_modules/lodash/package.json

Library home page: http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz

Dependency Hierarchy:

  • jshint-loader-0.8.4.tgz (Root Library)
    • rcloader-0.1.2.tgz
      • lodash-2.4.2.tgz (Vulnerable Library)

Vulnerability Details

lodash node module before 4.17.5 suffers from a Modification of Assumed-Immutable Data (MAID) vulnerability via defaultsDeep, merge, and mergeWith functions, which allows a malicious user to modify the prototype of "Object" via proto, causing the addition or modification of an existing property that will exist on all objects.

Publish Date: 2018-06-07

URL: CVE-2018-3721

CVSS 3 Score Details (6.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: Low
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: High
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://nvd.nist.gov/vuln/detail/CVE-2018-3721

Release Date: 2018-06-07

Fix Resolution: 4.17.5


Step up your Open Source Security Game with WhiteSource here

180 degree mode?

Is it possible in the current framework to project an image/video on to a hemisphere for 180 footage?

CVE-2017-16138 High Severity Vulnerability detected by WhiteSource

CVE-2017-16138 - High Severity Vulnerability

Vulnerable Library - mime-1.3.6.tgz

A comprehensive library for mime-type mapping

path: /tmp/git/webvr-starter-kit/node_modules/mime/package.json

Library home page: https://registry.npmjs.org/mime/-/mime-1.3.6.tgz

Dependency Hierarchy:

  • url-loader-0.5.9.tgz (Root Library)
    • mime-1.3.6.tgz (Vulnerable Library)

Vulnerability Details

The mime module < 1.4.1, 2.0.1, 2.0.2 is vulnerable to regular expression denial of service when a mime lookup is performed on untrusted user input.

Publish Date: 2018-06-07

URL: CVE-2017-16138

CVSS 3 Score Details (7.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: High

For more information on CVSS3 Scores, click here.


Step up your Open Source Security Game with WhiteSource here

Error reading string. Unexpected token: StartObject

Console message on IE11/Windows 8.1
SourceMap http://povdocs.github.io/webvr-starter-kit/build/vr.js.map read failed: Error reading string. Unexpected token: StartObject. Path 'names[1191]', line 1, position 18677.'iexplore.exe' (Script): Unloaded 'http://povdocs.github.io/webvr-starter-kit/build/vr.js'

<title>WebVR sample</title> <script src="http://povdocs.github.io/webvr-starter-kit/build/vr.js"></script> <script type="text/javascript"> //Make a floor, with default checkerboard texture and tinted blue VR.floor({ color: 'lightblue' });
    //make a box, using brick-tiles material. Move it up and over.
    VR.box()
      .setMaterial('brick-tiles')
      .moveTo(-2, 1, 0.5);

    //make a sphere, using shiny, metal material. make it a bit bigger and move it up
    VR.sphere()
      .setMaterial('metal')
      .setScale(1.4)
      .moveTo(0, 1, 0);

    //make a torus, using wood material. Move it up and over
    VR.torus()
      .setMaterial('wood')
      .moveTo(2, 1, 0.5);
</script>

WS-2019-0019 Medium Severity Vulnerability detected by WhiteSource

WS-2019-0019 - Medium Severity Vulnerability

Vulnerable Library - braces-1.8.5.tgz

Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.

path: /tmp/git/webvr-starter-kit/node_modules/anymatch/node_modules/braces/package.json

Library home page: https://registry.npmjs.org/braces/-/braces-1.8.5.tgz

Dependency Hierarchy:

  • main-bower-files-2.13.1.tgz (Root Library)
    • vinyl-fs-2.4.4.tgz
      • glob-stream-5.3.5.tgz
        • micromatch-2.3.11.tgz
          • braces-1.8.5.tgz (Vulnerable Library)

Vulnerability Details

Version of braces prior to 2.3.1 are vulnerable to Regular Expression Denial of Service (ReDoS). Untrusted input may cause catastrophic backtracking while matching regular expressions. This can cause the application to be unresponsive leading to Denial of Service.

Publish Date: 2019-03-25

URL: WS-2019-0019

CVSS 2 Score Details (5.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://www.npmjs.com/advisories/786

Release Date: 2019-02-21

Fix Resolution: 2.3.1


Step up your Open Source Security Game with WhiteSource here

Loading an object

This library is really great, thank you so much!

I'm wondering if you have an example of loading an object (.obj) file and material with it. There doesn't seem to be any out of the box functionality to do that, so would you still need to use Three's OBJLoader?

It'd be really useful to be able to do something like:

VR.load({
  path: 'path-to-obj-file'
});

Firing 'DeviceChange' on desktop

Console message reads:

"main.min.js:15 THREE.WebGLRenderer 72dev
main.min.js:15 Uncaught TypeError: Failed to execute 'setPosition' on 'AudioListener': The provided float value is non-finite."

Chrome: Version 45.0.2454.93 (64-bit)
Mac OSX: 10.8.5

Improve selection of view control modes

Should break it down into more usable/configurable methods for looking around.

  • VR mode:
    • Always full screen
    • Render two eyes
    • Disable mouse/touch control
    • Automatically pick HMD or devicemotion
    • Disable if neither HMD or devicemotion is available
  • Non-VR mode (default)
    • single camera view only
    • mouse/touch control always on (set mouse pointer)
    • manually toggle full-screen if available
    • manually toggle devicemotion if available (in case HDD MacBook has it)

Whenever we're in full-screen (VR or not), need a button to exit. Normally invisible, but revealed for a few seconds by any mousemove or touch event.

Rotations in degrees?

What do you guys think about having the rotate operations accept degrees instead of radians? This could break existing content but would be much easier for people to use.

can't get current position of an object via code

hi, im trying to make a game that supports physics and collision without needing any other external libraries, and im stuck on getting the objects position... heres some example code so you can see what im trying to do...

    var sphere = VR.sphere()
      .setMaterial('metal')
      .setScale(1.4)
      .moveTo(1, 9, 2);

    var spherePosX = sphere.x //get X position of sphere 
    var spherePosY = sphere.y //get Y position of sphere
    var spherePosZ = sphere.z //get Z position of sphere

i know the above code is wrong, but idk what to put in place of 'sphere.x', 'sphere.y', and 'sphere.z' please help me!

WS-2018-0107 High Severity Vulnerability detected by WhiteSource

WS-2018-0107 - High Severity Vulnerability

Vulnerable Library - open-0.0.5.tgz

open a file or url in the user's preferred application

path: /tmp/git/webvr-starter-kit/node_modules/open/package.json

Library home page: http://registry.npmjs.org/open/-/open-0.0.5.tgz

Dependency Hierarchy:

  • webpack-dev-server-1.16.5.tgz (Root Library)
    • open-0.0.5.tgz (Vulnerable Library)

Vulnerability Details

All versions of open are vulnerable to command injection when unsanitized user input is passed in.

Publish Date: 2018-05-16

URL: WS-2018-0107

CVSS 2 Score Details (10.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://nodesecurity.io/advisories/663

Release Date: 2018-05-16

Fix Resolution: No fix is currently available for this vulnerability. It is our recommendation to not install or use this module until a fix is available.


Step up your Open Source Security Game with WhiteSource here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.