-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77bf03e
commit fd8161f
Showing
30 changed files
with
210 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added
BIN
+389 KB
src/assets/portals/portal_window_frame/portal_window_frame_diffuse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+513 KB
src/assets/portals/portal_window_frame/portal_window_frame_specular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
src/components/elements/SnapCameraAR/LoadingStateConstants.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
import * as React from 'react'; | ||
import {StyleSheet} from 'react-native'; | ||
import {ViroARSceneNavigator} from '@viro-community/react-viro'; | ||
|
||
interface IProps { | ||
initialScene: any; | ||
bloomEnabled?: boolean; | ||
hdrEnabled?: boolean; | ||
autoFocus?: boolean; | ||
onInitialized: (state: any, reason: any) => void; | ||
//modelItems?: ArtRowItem; | ||
onInitialScene: () => void; | ||
} | ||
|
||
interface IState {} | ||
interface IState { | ||
bloomEnabled?: boolean; | ||
hdrEnabled?: boolean; | ||
autoFocus?: boolean; | ||
} | ||
|
||
export default class SnapCameraAR extends React.PureComponent<IProps, IState> { | ||
state: IState = { | ||
bloomEnabled: this.props.bloomEnabled ? this.props.bloomEnabled : false, | ||
hdrEnabled: this.props.hdrEnabled ? this.props.hdrEnabled : false, | ||
autoFocus: this.props.autoFocus ? this.props.autoFocus : false, | ||
}; | ||
render() { | ||
return ( | ||
<ViroARSceneNavigator | ||
bloomEnabled={true} | ||
hdrEnabled={true} | ||
style={{flex: 1}} | ||
bloomEnabled={this.state.bloomEnabled} | ||
hdrEnabled={this.state.hdrEnabled} | ||
autofocus={this.state.autoFocus} | ||
style={styles.screenNavContainer} | ||
initialScene={{ | ||
scene: () => { | ||
return this.props.initialScene; | ||
}, | ||
scene: this.props.onInitialScene, | ||
}} | ||
/> | ||
); | ||
} | ||
} | ||
const styles = StyleSheet.create({ | ||
screenNavContainer: { | ||
flex: 1, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import {ImageSourcePropType} from 'react-native'; | ||
const faker = require('@faker-js/faker'); | ||
import { | ||
PortalRowItem, | ||
LOADED, | ||
LOADING, | ||
LOAD_ERROR, | ||
NONE, | ||
POSITION_OFFSET, | ||
} from '@src/redux/PortalRowItem'; | ||
|
||
export const mockPortals: PortalRowItem[] = [ | ||
{ | ||
name: 'portal_window_frame', | ||
selected: false, | ||
loading: NONE, | ||
icon_img: require('../res/icon_portal_windowframe.png'), | ||
obj: require('../res/portal_window_frame/portal_window_frame.vrx'), | ||
materials: null, | ||
portal360Image: { | ||
source: require('../res/360_guadalupe.jpg'), | ||
width: 2, | ||
height: 1, | ||
}, | ||
animation: null, | ||
scale: [1, 1, 1], | ||
portalScale: [0.275, 0.275, 0.275], | ||
position: [0, 0, 0], | ||
frameType: 'VRX', | ||
physics: undefined, | ||
ref_pointer: undefined, | ||
resources: [ | ||
require('../res/portal_window_frame/portal_window_frame_specular.png'), | ||
require('../res/portal_window_frame/portal_window_frame_diffuse.png'), | ||
require('../res/portal_window_frame/portal_window_frame_normal.png'), | ||
], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {ImageSourcePropType} from 'react-native'; | ||
|
||
export interface Image360 { | ||
source: ImageSourcePropType; | ||
width: number; | ||
height: number; | ||
} | ||
|
||
export interface PortalRowItem { | ||
id?: string; | ||
name?: string; | ||
seq?: number; | ||
icon_img: ImageSourcePropType; | ||
obj?: ImageSourcePropType; | ||
portal360Image?: Image360; | ||
resources?: Array<ImageSourcePropType>; | ||
frameType?: string; | ||
scale?: any; | ||
portalScale?: any; | ||
position?: any; | ||
materials?: any; | ||
animation?: any; | ||
loading?: string; | ||
physics?: any; | ||
ref_pointer?: any; | ||
selected?: boolean; | ||
} | ||
|
||
export const NONE = 'NONE'; | ||
export const LOADING = 'LOADING'; | ||
export const LOAD_ERROR = 'ERROR'; | ||
export const LOADED = 'LOADED'; | ||
export const POSITION_OFFSET = 0.05; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { | ||
createAsyncThunk, | ||
createSlice, | ||
createEntityAdapter, | ||
PayloadAction, | ||
} from '@reduxjs/toolkit'; | ||
|
||
import {mockArts} from '@src/data/mock-arts'; | ||
import {ArtRowItem} from '@src/redux/ArtRowItem'; | ||
import {RootState} from '../useRedux'; | ||
|
||
const sliceName = 'portalSlice'; | ||
type arts = ArtRowItem; | ||
|
||
export type ArtState = { | ||
loading?: boolean | null | undefined; | ||
planReady?: boolean | null | undefined; | ||
allArts?: Array<ArtRowItem>; | ||
selectedArt?: ArtRowItem; | ||
}; | ||
|
||
type ArtPayload = { | ||
payload: { | ||
loading?: boolean | null | undefined; | ||
planReady?: boolean | null | undefined; | ||
allArts?: Array<ArtRowItem>; | ||
selectedArt?: ArtRowItem; | ||
}; | ||
}; | ||
|
||
//Sample from ts-rn | ||
export const fetchArtsAPI = createAsyncThunk( | ||
`${sliceName}/fetchArts-api`, | ||
async () => { | ||
return mockArts; | ||
}, | ||
); | ||
//Source from modern-redux | ||
const artsAdapter = createEntityAdapter<arts>({ | ||
selectId: (arts: ArtRowItem) => arts.id as any, | ||
}); | ||
|
||
const slice = createSlice({ | ||
name: sliceName, | ||
initialState: artsAdapter.getInitialState({ | ||
loading: false, | ||
planReady: false, | ||
allArts: [], | ||
selectedArt: undefined, | ||
} as ArtState), | ||
reducers: { | ||
updatePlanStatus(state: ArtState, {payload: {planReady}}: ArtPayload) { | ||
state.planReady = planReady; | ||
}, | ||
updateSelectedArt(state: ArtState, action: PayloadAction<ArtRowItem>) { | ||
state.allArts?.push(action.payload); | ||
state.selectedArt = action.payload; | ||
}, | ||
resetSelectionArts(state: ArtState) { | ||
state.allArts = []; | ||
state.selectedArt = undefined; | ||
}, | ||
}, | ||
extraReducers: (builder) => { | ||
builder.addCase(fetchArtsAPI.pending, (state) => { | ||
state.loading = true; | ||
}); | ||
builder.addCase(fetchArtsAPI.fulfilled, (state, action) => { | ||
artsAdapter.setAll(state, action.payload); | ||
state.loading = false; | ||
}); | ||
builder.addCase(fetchArtsAPI.rejected, (state) => { | ||
state.loading = false; | ||
}); | ||
}, | ||
}); | ||
|
||
//Sample from ts-rn | ||
const {actions, reducer} = slice; | ||
|
||
export const {updatePlanStatus, updateSelectedArt, resetSelectionArts} = | ||
actions; | ||
export const fetchAllSelectionArts = (state: RootState) => | ||
state.artSlice.allArts; | ||
export const selectedArt = (state: RootState) => state.artSlice.selectedArt; | ||
export const fetchPlanStatus = (state: RootState) => state.artSlice.planReady; | ||
|
||
export const {selectAll: selectArts} = artsAdapter.getSelectors( | ||
(state: RootState) => state.artSlice, | ||
); | ||
export default reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.