-
Notifications
You must be signed in to change notification settings - Fork 11
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
e043782
commit 1aaa6af
Showing
7 changed files
with
668 additions
and
214 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,42 +1,82 @@ | ||
import React from 'react'; | ||
import { Sparkles, StatsGl } from '@react-three/drei'; | ||
import { createBrowserRouter, RouterProvider } from 'react-router-dom'; | ||
|
||
import { Avatar } from 'src/components/Avatar'; | ||
import { EnvironmentModel } from 'src/components/Models'; | ||
import { Avatar, CAMERA } from 'src/components/Avatar'; | ||
|
||
import { Sparkles, StatsGl } from '@react-three/drei'; | ||
import { EnvironmentModel } from 'src/library'; | ||
import styles from './App.module.scss'; | ||
|
||
function App() { | ||
return ( | ||
<div className={styles.app}> | ||
<div className={styles.settings}> | ||
<div className={styles.wrapper}> | ||
<h3 className={styles.title}>localhost playground</h3> | ||
<div className={styles.content}> | ||
Drop your content in there to test the avatar props without shrinking the canvas | ||
</div> | ||
const AvatarDevelop: React.FC = () => ( | ||
<div className={styles.app}> | ||
<div className={styles.settings}> | ||
<div className={styles.wrapper}> | ||
<h3 className={styles.title}>localhost playground</h3> | ||
<div className={styles.content}> | ||
Drop your content in there to test the avatar props without shrinking the canvas | ||
</div> | ||
</div> | ||
</div> | ||
<div className={styles.container}> | ||
<div className={styles.card}> | ||
<Avatar | ||
modelSrc="https://models.readyplayer.me/64d61e9e17883fd73ebe5eb7.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0" | ||
shadows | ||
animationSrc="/male-idle-2.fbx" | ||
style={{ background: 'rgb(9,20,26)' }} | ||
fov={45} | ||
effects={{ | ||
ambientOcclusion: true | ||
}} | ||
> | ||
<StatsGl /> | ||
<EnvironmentModel environment="spaceStation" scale={1} /> | ||
<Sparkles count={70} scale={3} size={3} speed={1} opacity={0.04} color="#ccff00" /> | ||
</Avatar> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
const AvatarTest: React.FC = () => { | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const modelUrl = urlParams.get('modelUrl') | ||
? decodeURIComponent(urlParams.get('modelUrl') || '') | ||
: 'https://models.readyplayer.me/64d61e9e17883fd73ebe5eb7.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0'; | ||
|
||
return ( | ||
<div className={styles.app}> | ||
<div className={styles.container}> | ||
<div className={styles.card}> | ||
<Avatar | ||
modelSrc="https://models.readyplayer.me/64d61e9e17883fd73ebe5eb7.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0" | ||
modelSrc={modelUrl} | ||
shadows | ||
animationSrc="/male-idle-2.fbx" | ||
style={{ background: 'rgb(9,20,26)' }} | ||
fov={45} | ||
cameraInitialDistance={CAMERA.CONTROLS.FULL_BODY.MAX_DISTANCE} | ||
effects={{ | ||
ambientOcclusion: true | ||
}} | ||
> | ||
<StatsGl /> | ||
<EnvironmentModel environment="spaceStation" scale={1} /> | ||
<Sparkles count={70} scale={3} size={3} speed={1} opacity={0.04} color="#ccff00" /> | ||
{/* <StatsGl /> */} | ||
</Avatar> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: '/', | ||
element: <AvatarDevelop /> | ||
}, | ||
{ | ||
path: '/test', | ||
element: <AvatarTest /> | ||
} | ||
]); | ||
|
||
const App: React.FC = () => <RouterProvider router={router} />; | ||
|
||
export default App; |
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 |
---|---|---|
@@ -1,5 +1,13 @@ | ||
describe('visual', () => { | ||
it('open', () => { | ||
cy.visit('http://localhost:3000/'); | ||
const MODEL_URL = 'https://api.readyplayer.dev/v3/avatars/65f82db95462c113fe5c5bb6.glb'; | ||
|
||
cy.visit(`http://localhost:3000/test/?modelUrl=${encodeURIComponent(MODEL_URL)}`); | ||
|
||
cy.intercept(MODEL_URL).as('modelDownloading'); | ||
cy.wait('@modelDownloading'); | ||
|
||
cy.wait(2000); | ||
cy.compareSnapshot('home-page'); | ||
}); | ||
}); |
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,37 +1,3 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************** | ||
// This example commands.ts shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
// | ||
// declare global { | ||
// namespace Cypress { | ||
// interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
// } | ||
// } | ||
// } | ||
import compareSnapshotCommand from 'cypress-image-diff-js/command'; | ||
|
||
compareSnapshotCommand(); |
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