Add scale to models

This commit is contained in:
John Lyon-Smith
2018-05-15 15:52:24 -07:00
parent c3546be1a1
commit 5c135dd7ea
3 changed files with 11 additions and 35 deletions

View File

@@ -95,11 +95,11 @@ def enableProguardInReleaseBuilds = false
android {
buildToolsVersion "27.0.3"
compileSdkVersion 25
compileSdkVersion 27
defaultConfig {
applicationId "com.deightonar"
minSdkVersion 23
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0.0"

View File

@@ -22,14 +22,17 @@ const shapes = {
order: {
source: require("./models/hardhat_obj.obj"),
resources: [require("./models/hardhat.mtl")],
scale: [0.5, 0.5, 0.5],
},
complaint: {
source: require("./models/question_obj.obj"),
resources: [require("./models/question.mtl")],
scale: [1, 1, 1],
},
inspection: {
source: require("./models/clipboard_obj.obj"),
resources: [require("./models/clipboard.mtl")],
scale: [1, 1, 1],
},
}
@@ -48,7 +51,6 @@ class WorkItemSceneAR extends React.Component {
this.state = {
position: [0, 0, 0],
rotation: [0, 0, 0],
scale: [0.2, 0.2, 0.2],
shouldBillboard: true,
trackingInitialized: false,
haveAnchor: false,
@@ -85,8 +87,8 @@ class WorkItemSceneAR extends React.Component {
(result.transform.position[2] - position[2]) *
(result.transform.position[2] - position[2])
)
if (distance > 0.2 && distance < 10) {
// If we found a plane greater than .2 and less than 10 meters away then choose it!
if (distance > 1 && distance < 15) {
// If we found a plane a decent distance away, choose it!
hitResultPosition = result.transform.position
break
}
@@ -95,7 +97,7 @@ class WorkItemSceneAR extends React.Component {
// then we'll use it as the initial display point
let d = distance(position, result.transform.position)
if (d > 0.2 && d < 10) {
if (d > 1 && d < 15) {
hitResultPosition = result.transform.position
}
}
@@ -180,13 +182,12 @@ class WorkItemSceneAR extends React.Component {
ref={(ref) => (this.arNode = ref)}
transformBehaviors={shouldBillboard ? "billboardY" : []}
position={position}
scale={scale}
rotation={rotation}>
<ViroSpotLight
innerAngle={5}
outerAngle={20}
direction={[0, -1, 0]}
position={[0, 15, 0]}
position={[0, 30, 0]}
color="#ffffff"
castsShadow={true}
shadowNearZ={0.1}
@@ -200,6 +201,7 @@ class WorkItemSceneAR extends React.Component {
position={[0, 0, -1]}
source={shape.source}
resources={shape.resources}
scale={shape.scale}
type="OBJ"
onLoadEnd={this.handleLoadEnd}
onClick={this.handleClick}
@@ -207,7 +209,7 @@ class WorkItemSceneAR extends React.Component {
)}
<ViroQuad
rotation={[-90, 0, 0]}
position={[0, -0.001, 0]}
position={[0, -0.01, 0]}
width={2.5}
height={2.5}
arShadowReceiver={true}

View File

@@ -338,32 +338,6 @@ export class Home extends React.Component {
flexBasis: 0,
width: "100%",
}}>
{/*
// TODO: Search feature
<View
style={{
flexDirection: "row",
alignItems: "center",
width: "100%",
height: 40,
backgroundColor: "white",
}}>
<Icon
name="search"
size={16}
style={{ marginLeft: 10, marginRight: 5, tintColor: "gray" }}
/>
<TextInput
style={{ flexGrow: 1, flexBasis: 0, height: "100%" }}
underlineColorAndroid="white"
placeholder="Search"
/>
<Icon
style={{ marginLeft: 5, marginRight: 10 }}
name="cancel"
size={16}
/>
</View> */}
<SectionList
ref={(ref) => (this.sectionList = ref)}
style={{ width: "100%", flexGrow: 1 }}