regl-worldview
Advanced tools
Comparing version 0.12.2 to 0.13.0
{ | ||
"name": "regl-worldview", | ||
"version": "0.12.2", | ||
"version": "0.13.0", | ||
"description": "A reusable component for rendering 2D and 3D views using regl", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -14,2 +14,3 @@ // @flow | ||
import { createInstancedGetChildrenForHitmap } from "../utils/getChildrenForHitmapDefaults"; | ||
import withRenderStateOverrides from "../utils/withRenderStateOverrides"; | ||
import Command, { type CommonCommandProps } from "./Command"; | ||
@@ -20,3 +21,3 @@ import { createCylinderGeometry } from "./Cylinders"; | ||
const cones = fromGeometry(points, sideFaces.concat(endCapFaces)); | ||
const cones = withRenderStateOverrides(fromGeometry(points, sideFaces.concat(endCapFaces))); | ||
@@ -23,0 +24,0 @@ const getChildrenForHitmap = createInstancedGetChildrenForHitmap(1); |
@@ -14,37 +14,40 @@ // @flow | ||
import { createInstancedGetChildrenForHitmap } from "../utils/getChildrenForHitmapDefaults"; | ||
import withRenderStateOverrides from "../utils/withRenderStateOverrides"; | ||
import Command, { type CommonCommandProps } from "./Command"; | ||
const cubes = fromGeometry( | ||
[ | ||
// bottom face corners | ||
[-0.5, -0.5, -0.5], | ||
[-0.5, 0.5, -0.5], | ||
[0.5, -0.5, -0.5], | ||
[0.5, 0.5, -0.5], | ||
// top face corners | ||
[-0.5, -0.5, 0.5], | ||
[-0.5, 0.5, 0.5], | ||
[0.5, -0.5, 0.5], | ||
[0.5, 0.5, 0.5], | ||
], | ||
[ | ||
// bottom | ||
[0, 1, 2], | ||
[1, 2, 3], | ||
// top | ||
[4, 5, 6], | ||
[5, 6, 7], | ||
// left | ||
[0, 2, 4], | ||
[2, 4, 6], | ||
// right | ||
[1, 3, 5], | ||
[3, 5, 7], | ||
//front | ||
[2, 3, 6], | ||
[3, 6, 7], | ||
//back | ||
[0, 1, 4], | ||
[1, 4, 5], | ||
] | ||
const cubes = withRenderStateOverrides( | ||
fromGeometry( | ||
[ | ||
// bottom face corners | ||
[-0.5, -0.5, -0.5], | ||
[-0.5, 0.5, -0.5], | ||
[0.5, -0.5, -0.5], | ||
[0.5, 0.5, -0.5], | ||
// top face corners | ||
[-0.5, -0.5, 0.5], | ||
[-0.5, 0.5, 0.5], | ||
[0.5, -0.5, 0.5], | ||
[0.5, 0.5, 0.5], | ||
], | ||
[ | ||
// bottom | ||
[0, 1, 2], | ||
[1, 2, 3], | ||
// top | ||
[4, 5, 6], | ||
[5, 6, 7], | ||
// left | ||
[0, 2, 4], | ||
[2, 4, 6], | ||
// right | ||
[1, 3, 5], | ||
[3, 5, 7], | ||
//front | ||
[2, 3, 6], | ||
[3, 6, 7], | ||
//back | ||
[0, 1, 4], | ||
[1, 4, 5], | ||
] | ||
) | ||
); | ||
@@ -51,0 +54,0 @@ |
@@ -14,2 +14,3 @@ // @flow | ||
import { createInstancedGetChildrenForHitmap } from "../utils/getChildrenForHitmapDefaults"; | ||
import withRenderStateOverrides from "../utils/withRenderStateOverrides"; | ||
import Command, { type CommonCommandProps } from "./Command"; | ||
@@ -51,3 +52,3 @@ | ||
const cylinders = fromGeometry(points, sideFaces.concat(endCapFaces)); | ||
const cylinders = withRenderStateOverrides(fromGeometry(points, sideFaces.concat(endCapFaces))); | ||
@@ -54,0 +55,0 @@ const getChildrenForHitmap = createInstancedGetChildrenForHitmap(1); |
@@ -14,2 +14,3 @@ // @flow | ||
import { createInstancedGetChildrenForHitmap } from "../utils/getChildrenForHitmapDefaults"; | ||
import withRenderStateOverrides from "../utils/withRenderStateOverrides"; | ||
import Command, { type CommonCommandProps } from "./Command"; | ||
@@ -58,3 +59,3 @@ | ||
const spheres = fromGeometry(points, faces); | ||
const spheres = withRenderStateOverrides(fromGeometry(points, faces)); | ||
@@ -61,0 +62,0 @@ const getChildrenForHitmap = createInstancedGetChildrenForHitmap(1); |
@@ -8,3 +8,3 @@ // @flow | ||
import Container from "./Container"; | ||
import { cube, p, UNIT_QUATERNION, buildMatrix, rng } from "./util"; | ||
import { cube, p, UNIT_QUATERNION, buildMatrix, rng, withCustomRenderStates } from "./util"; | ||
import withRange from "./withRange"; | ||
@@ -144,2 +144,10 @@ | ||
}) | ||
); | ||
) | ||
.add("<Cubes> - with custom depth and blend values", () => { | ||
const cubes = withCustomRenderStates([cube(0)], [cube(1)]); | ||
return ( | ||
<Container cameraState={{ perspective: true }}> | ||
<Wrapper cubes={cubes} /> | ||
</Container> | ||
); | ||
}); |
@@ -38,1 +38,54 @@ // @flow | ||
}; | ||
export const withCustomRenderStates = (markers1: any, markers2: any) => { | ||
const magenta = markers1.map((marker) => ({ | ||
...marker, | ||
colors: [], | ||
color: { r: 1, g: 0, b: 1, a: 1 }, | ||
depth: { | ||
enable: true, | ||
mask: true, | ||
}, | ||
blend: { | ||
enable: true, | ||
func: { | ||
src: "constant color", | ||
dst: "src alpha", | ||
}, | ||
color: [1, 0, 1, 1], | ||
}, | ||
})); | ||
const gray = markers2.map((marker) => ({ | ||
...marker, | ||
colors: [], | ||
color: { r: 0.5, g: 0.5, b: 0.5, a: 1 }, | ||
depth: { | ||
enable: false, | ||
}, | ||
blend: { | ||
enable: true, | ||
func: { | ||
src: "constant color", | ||
dst: "zero", | ||
}, | ||
color: [0.5, 0.5, 0.5, 1.0], | ||
}, | ||
})); | ||
const cyan = markers2.map((marker) => ({ | ||
...marker, | ||
colors: [], | ||
color: { r: 0, g: 1, b: 1, a: 1 }, | ||
depth: { | ||
enable: true, | ||
}, | ||
blend: { | ||
enable: true, | ||
func: { | ||
src: "constant color", | ||
dst: "one", | ||
}, | ||
color: [0, 1, 1, 1], | ||
}, | ||
})); | ||
return [...magenta, ...gray, ...cyan]; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
4681335
93
20461