Skip to content

Commit

Permalink
add documentation tester for link checking (fixes aframevr#2079) (afr…
Browse files Browse the repository at this point in the history
…amevr#2080)

* add documentation tester for link checking (fixes aframevr#2079)

* test anchor links
  • Loading branch information
ngokevin authored and dmarcos committed Nov 10, 2016
1 parent 1e67506 commit 2e26034
Show file tree
Hide file tree
Showing 24 changed files with 299 additions and 136 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
- CI_ACTION="npm run test:ci"
- CI_ACTION="npm run lint"
- CI_ACTION="npm run build"
- CI_ACTION="npm run test:docs"

branches:
only:
Expand Down
9 changes: 7 additions & 2 deletions docs/components/cursor.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ The cursor will add states to intersected entities on certain events:

## Configuring the Cursor through the Raycaster Component

The cursor is built on top of and depends on the raycaster component. If we want to customize the raycasting pieces of the cursor, we can do by changing the [raycaster component properties][raycasterprops]. Say we want set a max distance, check for intersections less frequently, and set which objects are clickable:
[raycasterprops]: ./raycaster.md#properties

The cursor is built on top of and depends on the raycaster component. If we
want to customize the raycasting pieces of the cursor, we can do by changing
the [raycaster component properties][raycasterprops]. Say we want set a max
distance, check for intersections less frequently, and set which objects are
clickable:

```html
<a-entity cursor raycaster="far: 20; interval: 1000; objects: .clickable"></a-entity>
Expand Down Expand Up @@ -116,4 +122,3 @@ To play with an example of a cursor with visual feedback, check out the [Cursor
[geometry]: ./geometry.md
[material]: ./material.md
[raycaster]: ./raycaster.md
[raycasterprops]: ./raycaster.md#Properties
2 changes: 0 additions & 2 deletions docs/components/look-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ component][components-camera].
If you want to create your own component for look controls, you will have to
copy and paste the HMD-tracking bits into your component. In the future, we may
have a system for people to more easily implement their controls.

[components-camera]: ../components/index.md
48 changes: 24 additions & 24 deletions docs/components/material.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ layout: docs
parent_section: components
---

[fog]: ./fog.md
[geometry]: ./geometry.md

The material component gives appearance to an entity. We can define properties
such as color, opacity, or texture. This is often paired with the [geometry
component][geometry] which provides shape.
Expand Down Expand Up @@ -37,6 +40,9 @@ Here is an example of using an example custom material:

## Properties

[flat]: #flat
[standard]: #standard

The material component has a few base properties. More properties will be
available depending on the material applied.

Expand All @@ -63,8 +69,10 @@ A-Frame ships with a few built-in materials.

### `standard`

[threestandardmaterial]: http://threejs.org/docs/#Reference/Materials/MeshStandardMaterial

The `standard` material is the default material. It uses the physically-based
[THREE.MeshStandardMaterial][standard].
[THREE.MeshStandardMaterial][threestandardmaterial].

#### Properties

Expand Down Expand Up @@ -159,6 +167,7 @@ For example:

### `flat`

[basic]: http://threejs.org/docs/#Reference/Materials/MeshBasicMaterial

The `flat` material uses the [THREE.MeshBasicMaterial][basic]. Flat materials
are not affected by the scene's lighting conditions. This is useful for things
Expand All @@ -183,6 +192,8 @@ such as images or videos. Set `shader` to `flat`:

## Textures

[asm]: ../core/asset-management-system.md

To set a texture using one of the built-in materials, specify the `src`
property. `src` can be a selector to either an `<img>` or `<video>` element in the
[asset management system][asm]:
Expand Down Expand Up @@ -234,6 +245,8 @@ selector for the `id` attribute (e.g., `#my-video`):

#### Controlling Video Textures

[mediaplayback]: https://developer.mozilla.org/docs/Web/Guide/HTML/Using_HTML5_audio_and_video#Controlling_media_playback

To control the video playback such as pausing or seeking, we can use the video
element to [control media playback][mediaplayback]. For example:

Expand Down Expand Up @@ -329,6 +342,8 @@ AFRAME.registerShader('custom', {

### Example

[line-dashed]: http://threejs.org/docs/index.html#Reference/Materials/LineDashedMaterial

To create a custom material, we have the `init` and `update` handlers set and
update `this.material` to the desired material. Here is an example of
registering a [`THREE.LinedDashedMaterial`][line-dashed]:
Expand Down Expand Up @@ -360,9 +375,14 @@ AFRAME.registerShader('line-dashed', {

## Register a Custom GLSL Shader

[component-schema]: ../core/component.md#schema
[shader-material]: http://threejs.org/docs/#Reference/Materials/ShaderMaterial

We also use `registerShader` for registering
[THREE.ShaderMaterial][shader-material]s to create custom shaders.

[glsl]: https://en.wikipedia.org/wiki/OpenGL_Shading_Language

We can provide our own [GLSL][glsl] vertex and fragment shaders (small programs
that run on the GPU), and we can define a schema for their uniforms and
attributes just as we would with [component schemas][component-schema]. The
Expand Down Expand Up @@ -433,28 +453,8 @@ properties like we would with components:

### Additional Resources

- [A-Frame Shader Example][shaderex]
- [ShaderToy][shadertoy]

[asm]: ../core/asset-management-system.md
[basic]: http://threejs.org/docs/#Reference/Materials/MeshBasicMaterial
[built-in]: #built-in_shading_models
[component-schema]: ../core/component.md#schema
[corsimage]: https://developer.mozilla.org/docs/Web/HTML/CORS_enabled_image
[cross-component-changes]: http://codepen.io/team/mozvr/pen/NxEpJe
[customshader]: ../core/shaders.md#registering_a_custom_shader
[flat]: ../core/shaders.md#flat_shading_model
[fog]: ../components/fog.md
[geometry]: ./geometry.md
[glsl]: https://en.wikipedia.org/wiki/OpenGL_Shading_Language
[line-dashed]: http://threejs.org/docs/index.html#Reference/Materials/LineDashedMaterial
[material]: ../components/material.md
[mediaplayback]: https://developer.mozilla.org/docs/Web/Guide/HTML/Using_HTML5_audio_and_video#Controlling_media_playback
[register-custom-shaders]: #registering_a_custom_shader
[shader-material]: http://threejs.org/docs/#Reference/Materials/ShaderMaterial
[shaderex]: https://github.com/aframevr/aframe/tree/50a07cac9cd2f764b9ff4cd0a5bb20e408f8f4d6/examples/test-shaders
[shaders]: ../core/shaders.md
[shadertoy]: https://www.shadertoy.com
[standard]: ../core/shaders.md#standard_shading_model
[standard]: http://threejs.org/docs/#Reference/Materials/MeshStandardMaterial
[threematerial]: http://threejs.org/docs/#Reference/Materials/Material

- [A-Frame Shader Example][shaderex]
- [ShaderToy][shadertoy]
15 changes: 8 additions & 7 deletions docs/components/pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ layout: docs
parent_section: components
---

A pool of entities that will be reused. It avoids creating and destroying the same kind of entities in dynamic scenes. It will help reduce GC pauses. Useful for instance in a game where you want to reuse enemy entities.
A pool of entities that will be reused. It avoids creating and destroying the
same kind of entities in dynamic scenes. It will help reduce GC pauses. Useful
for instance in a game where you want to reuse enemy entities.

## Example

Expand All @@ -15,9 +17,8 @@ A pool of entities that will be reused. It avoids creating and destroying the sa

## Properties

| Property | Description | Default Value |
|----------|--------------------------------------------------------------------------------------|---------------|
| mixin | Mixin used to initialize the entities of the pool. | '' |
| size | the number of preallocated entities in the pool | 0 |
| dynamic | the pool grows automatically if more entities are requested after reaching the current size | false |
[scene]: ../core/scene.md
| Property | Description | Default Value |
|----------|---------------------------------------------------------------------------------------------|---------------|
| mixin | Mixin used to initialize the entities of the pool. | '' |
| size | the number of preallocated entities in the pool | 0 |
| dynamic | the pool grows automatically if more entities are requested after reaching the current size | false |
2 changes: 0 additions & 2 deletions docs/components/screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ attached to the scene by default so it's automatically available on each scene.
| width | The width in pixels of the screenshot taken. | 4096 |
| height | The height in pixels of the screenshot taken. | 2048 |
| projection | The screenshot projection: `perspective` or `equirectangular`. | equirectangular |

[scene]: ../core/scene.md
6 changes: 3 additions & 3 deletions docs/components/sound.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ layout: docs
parent_section: components
---

[position]: ./position.md

The sound component defines the entity as a source of sound or audio. The sound
component is positional and is therefore affected by the
[components-position](position.md).
[components-position][position].

## Example

Expand Down Expand Up @@ -88,5 +90,3 @@ And to play the sound:
```js
entity.components.sound.playSound();
```

[components-position]: ./position.md
4 changes: 2 additions & 2 deletions docs/components/wasd-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ layout: docs
parent_section: components
---

[components-camera]: ./camera.md

The wasd-controls component defines the behavior of an entity to be controlled by the WASD keyboard keys. It is usually used alongside the [camera component][components-camera].

## Example
Expand All @@ -25,5 +27,3 @@ The wasd-controls component defines the behavior of an entity to be controlled b
| fly | Whether or not movement is restricted to the entity's initial plane. | false |
| wsAxis | Axis that the `W` and `S` keys act upon. | z |
| wsInverted | Whether the axis that the W and S keys act upon are inverted. | false |

[components-camera]: ../components/index.md
2 changes: 1 addition & 1 deletion docs/core/asset-management-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Uploader][uploader], a service that serves files with CORS headers set.

[corsimage]: https://developer.mozilla.org/docs/Web/HTML/CORS_enabled_image

Given that CORS headers *are* set, `<a-assets>` will automatically set
Given that [CORS headers][corsimage] *are* set, `<a-assets>` will automatically set
`crossorigin` attributes on media elements (e.g., `<audio>`, `<img>`,
`<video>`) if it detects the resource is on a different domain.

Expand Down
16 changes: 5 additions & 11 deletions docs/core/component.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ into the tick handler.
This is useful for things that need to update constantly such as controls or
physics.
### `.pause() and `.play()`
### `.pause()` and `.play()`
The `.pause` and `.play` methods are invoked when the entity calls its own
`.pause` or `.play` methods. Components should use this to stop or resume any
Expand Down Expand Up @@ -631,7 +631,10 @@ want to more granularly update objects for better performance.
#### Remove
For removal of the line mesh from the entity, we use [`Entity.removeObject3D`][removeObject3d]:
[removeobject3d]: ./entity.md#removeobject3d-type
For removal of the line mesh from the entity, we use
[`Entity.removeObject3D`][removeobject3d]:
```js
remove: function () {
Expand Down Expand Up @@ -669,25 +672,16 @@ And voila!
</span></div>
[camera]: ../components/camera.md
[collide]: https://github.com/dmarcos/a-invaders/tree/master/js/components
[component-to-dom-serialization]: ../components/debug.md#component-to-dom-serialization
[docs]: ./index.md
[ecs]: ./index.md
[entity]: ./entity.md
[follow]: https://jsbin.com/dasefeh/edit?html,output
[geometry]: ../components/geometry.md
[layout]: https://github.com/ngokevin/aframe-layout-component
[light]: ../components/light.md
[line-codepen]: http://codepen.io/team/mozvr/pen/yeEQNG
[look-controls]: ../components/look-controls.md
[object3d]: http://threejs.org/docs/#Reference/Core/Object3D
[multiple]: #multiple-instancing
[physics]: https://github.com/ngokevin/aframe-physics-components
[position]: ../components/position.md
[removeObject3d]: ./entity.md#remove-object3d
[rotation]: ../components/rotation.md
[sound]: ../components/sound.md
[text]: https://github.com/ngokevin/aframe-text-component
[three]: http://threejs.org/
[visible]: ../components/visible.md
[vrjump]: http://thevrjump.com
Loading

0 comments on commit 2e26034

Please sign in to comment.