Skip to content

add basic phycis support for primitives #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions components/ARBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARBox = createArComponent('addBox', {
shape: PropTypes.shape({
width: PropTypes.number,
height: PropTypes.number,
length: PropTypes.number,
chamfer: PropTypes.number,
}),
material,
});
const ARBox = createArComponent(
{ props: { shape: { type: 'box' } } },
{
shape: PropTypes.shape({
width: PropTypes.number,
height: PropTypes.number,
length: PropTypes.number,
chamfer: PropTypes.number
}),
material
}
);

export default ARBox;
17 changes: 10 additions & 7 deletions components/ARCapsule.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARCapsule = createArComponent('addCapsule', {
shape: PropTypes.shape({
capR: PropTypes.number,
height: PropTypes.number,
}),
material,
});
const ARCapsule = createArComponent(
{ props: { shape: { type: 'capsule' } } },
{
shape: PropTypes.shape({
capR: PropTypes.number,
height: PropTypes.number
}),
material
}
);

export default ARCapsule;
19 changes: 11 additions & 8 deletions components/ARCone.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARCone = createArComponent('addCone', {
shape: PropTypes.shape({
topR: PropTypes.number,
bottomR: PropTypes.number,
height: PropTypes.number,
}),
material,
});
const ARCone = createArComponent(
{ props: { shape: { type: 'cone' } } },
{
shape: PropTypes.shape({
topR: PropTypes.number,
bottomR: PropTypes.number,
height: PropTypes.number
}),
material
}
);

export default ARCone;
17 changes: 10 additions & 7 deletions components/ARCylinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARCylinder = createArComponent('addCylinder', {
shape: PropTypes.shape({
radius: PropTypes.number,
height: PropTypes.number,
}),
material,
});
const ARCylinder = createArComponent(
{ props: { shape: { type: 'cylinder' } } },
{
shape: PropTypes.shape({
radius: PropTypes.number,
height: PropTypes.number
}),
material
}
);

export default ARCylinder;
2 changes: 1 addition & 1 deletion components/ARGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

import createArComponent from './lib/createArComponent';

const ARBox = createArComponent('addGroup', {});
const ARBox = createArComponent({}, {});

export default ARBox;
49 changes: 27 additions & 22 deletions components/ARLight.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import PropTypes from 'prop-types';

import { NativeModules } from 'react-native';
import { categoryBitMask, color, lightType, shadowMode } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARLight = createArComponent('addLight', {
type: lightType,
color,
temperature: PropTypes.number,
intensity: PropTypes.number,
attenuationStartDistance: PropTypes.number,
attenuationEndDistance: PropTypes.number,
spotInnerAngle: PropTypes.number,
spotOuterAngle: PropTypes.number,
castsShadow: PropTypes.bool,
shadowRadius: PropTypes.number,
shadowColor: color,
// shadowMapSize: PropTypes.number,
shadowSampleCount: PropTypes.number,
shadowMode,
shadowBias: PropTypes.number,
orthographicScale: PropTypes.number,
zFar: PropTypes.number,
zNear: PropTypes.number,
lightCategoryBitMask: categoryBitMask,
});
const ARLight = createArComponent(
{
mount: NativeModules.ARGeosManager.addLight
},
{
type: lightType,
color,
temperature: PropTypes.number,
intensity: PropTypes.number,
attenuationStartDistance: PropTypes.number,
attenuationEndDistance: PropTypes.number,
spotInnerAngle: PropTypes.number,
spotOuterAngle: PropTypes.number,
castsShadow: PropTypes.bool,
shadowRadius: PropTypes.number,
shadowColor: color,
// shadowMapSize: PropTypes.number,
shadowSampleCount: PropTypes.number,
shadowMode,
shadowBias: PropTypes.number,
orthographicScale: PropTypes.number,
zFar: PropTypes.number,
zNear: PropTypes.number,
lightCategoryBitMask: categoryBitMask
}
);

export default ARLight;
25 changes: 14 additions & 11 deletions components/ARPlane.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARPlane = createArComponent('addPlane', {
shape: PropTypes.shape({
width: PropTypes.number,
height: PropTypes.number,
cornerRadius: PropTypes.number,
cornerSegmentCount: PropTypes.number,
widthSegmentCount: PropTypes.number,
heightSegmentCount: PropTypes.number,
}),
material,
});
const ARPlane = createArComponent(
{ props: { shape: { type: 'plane' } } },
{
shape: PropTypes.shape({
width: PropTypes.number,
height: PropTypes.number,
cornerRadius: PropTypes.number,
cornerSegmentCount: PropTypes.number,
widthSegmentCount: PropTypes.number,
heightSegmentCount: PropTypes.number
}),
material
}
);

export default ARPlane;
19 changes: 11 additions & 8 deletions components/ARPyramid.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARPyramid = createArComponent('addPyramid', {
shape: PropTypes.shape({
width: PropTypes.number,
length: PropTypes.number,
height: PropTypes.number,
}),
material,
});
const ARPyramid = createArComponent(
{ props: { shape: { type: 'pyramid' } } },
{
shape: PropTypes.shape({
width: PropTypes.number,
length: PropTypes.number,
height: PropTypes.number
}),
material
}
);

export default ARPyramid;
27 changes: 15 additions & 12 deletions components/ARShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ import PropTypes from 'prop-types';
import { chamferMode, material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARShape = createArComponent('addShape', {
shape: PropTypes.shape({
extrusion: PropTypes.number,
pathSvg: PropTypes.string,
pathFlatness: PropTypes.number,
chamferMode,
chamferRadius: PropTypes.number,
chamferProfilePathSvg: PropTypes.string,
chamferProfilePathFlatness: PropTypes.number,
}),
material,
});
const ARShape = createArComponent(
{ props: { shape: { type: 'shape' } } },
{
shape: PropTypes.shape({
extrusion: PropTypes.number,
pathSvg: PropTypes.string,
pathFlatness: PropTypes.number,
chamferMode,
chamferRadius: PropTypes.number,
chamferProfilePathSvg: PropTypes.string,
chamferProfilePathFlatness: PropTypes.number
}),
material
}
);

export default ARShape;
15 changes: 9 additions & 6 deletions components/ARSphere.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARSphere = createArComponent('addSphere', {
shape: PropTypes.shape({
radius: PropTypes.number,
}),
material,
});
const ARSphere = createArComponent(
{ props: { shape: { type: 'sphere' } } },
{
shape: PropTypes.shape({
radius: PropTypes.number
}),
material
}
);

export default ARSphere;
2 changes: 1 addition & 1 deletion components/ARText.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARText = createArComponent(
{ mount: NativeModules.ARTextManager.mount, pick: ['id', 'text', 'font'] },
{ mount: NativeModules.ARTextManager.mount },
{
text: PropTypes.string,
font: PropTypes.shape({
Expand Down
17 changes: 10 additions & 7 deletions components/ARTorus.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARTorus = createArComponent('addTorus', {
shape: PropTypes.shape({
ringR: PropTypes.number,
pipeR: PropTypes.number,
}),
material,
});
const ARTorus = createArComponent(
{ props: { shape: { type: 'torus' } } },
{
shape: PropTypes.shape({
ringR: PropTypes.number,
pipeR: PropTypes.number
}),
material
}
);

export default ARTorus;
19 changes: 11 additions & 8 deletions components/ARTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import PropTypes from 'prop-types';
import { material } from './lib/propTypes';
import createArComponent from './lib/createArComponent';

const ARTube = createArComponent('addTube', {
shape: PropTypes.shape({
innerR: PropTypes.number,
outerR: PropTypes.number,
height: PropTypes.number,
}),
material,
});
const ARTube = createArComponent(
{ props: { shape: { type: 'tube' } } },
{
shape: PropTypes.shape({
innerR: PropTypes.number,
outerR: PropTypes.number,
height: PropTypes.number
}),
material
}
);

export default ARTube;
Loading