mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-07-14 07:56:42 +00:00
move non-Next components out of app folder
This commit is contained in:
parent
fdd27b26d7
commit
beade00727
14 changed files with 41 additions and 44 deletions
16
app/page.tsx
16
app/page.tsx
|
|
@ -1,14 +1,14 @@
|
||||||
"use client";
|
"use client";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Canvas } from "@react-three/fiber";
|
|
||||||
import { Mission } from "./Mission";
|
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
||||||
import { ObserverControls } from "./ObserverControls";
|
|
||||||
import { InspectorControls } from "./InspectorControls";
|
|
||||||
import { SettingsProvider } from "./SettingsProvider";
|
|
||||||
import { EffectComposer, N8AO } from "@react-three/postprocessing";
|
|
||||||
import { useSearchParams, useRouter } from "next/navigation";
|
import { useSearchParams, useRouter } from "next/navigation";
|
||||||
import { ObserverCamera } from "./ObserverCamera";
|
import { Canvas } from "@react-three/fiber";
|
||||||
|
import { EffectComposer, N8AO } from "@react-three/postprocessing";
|
||||||
|
import { Mission } from "@/src/components/Mission";
|
||||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
import { ObserverControls } from "@/src/components/ObserverControls";
|
||||||
|
import { InspectorControls } from "@/src/components/InspectorControls";
|
||||||
|
import { SettingsProvider } from "@/src/components/SettingsProvider";
|
||||||
|
import { ObserverCamera } from "@/src/components/ObserverCamera";
|
||||||
|
|
||||||
// three.js has its own loaders for textures and models, but we need to load other
|
// three.js has its own loaders for textures and models, but we need to load other
|
||||||
// stuff too, e.g. missions, terrains, and more. This client is used for those.
|
// stuff too, e.g. missions, terrains, and more. This client is used for those.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { getResourceList } from "@/src/manifest";
|
import { getResourceList } from "../manifest";
|
||||||
import { useSettings } from "./SettingsProvider";
|
import { useSettings } from "./SettingsProvider";
|
||||||
|
|
||||||
const excludeMissions = new Set([
|
const excludeMissions = new Set([
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
|
import { memo, Suspense, useMemo } from "react";
|
||||||
|
import { Mesh } from "three";
|
||||||
import { useGLTF, useTexture } from "@react-three/drei";
|
import { useGLTF, useTexture } from "@react-three/drei";
|
||||||
import { BASE_URL, interiorTextureToUrl, interiorToUrl } from "@/src/loaders";
|
import { BASE_URL, interiorTextureToUrl, interiorToUrl } from "../loaders";
|
||||||
import {
|
import {
|
||||||
ConsoleObject,
|
ConsoleObject,
|
||||||
getPosition,
|
getPosition,
|
||||||
getProperty,
|
getProperty,
|
||||||
getRotation,
|
getRotation,
|
||||||
getScale,
|
getScale,
|
||||||
} from "@/src/mission";
|
} from "../mission";
|
||||||
import { memo, Suspense, useMemo } from "react";
|
import { setupColor } from "../textureUtils";
|
||||||
import { Mesh } from "three";
|
|
||||||
import { setupColor } from "@/src/textureUtils";
|
|
||||||
|
|
||||||
const FALLBACK_URL = `${BASE_URL}/black.png`;
|
const FALLBACK_URL = `${BASE_URL}/black.png`;
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { loadMission } from "@/src/loaders";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { loadMission } from "../loaders";
|
||||||
import { renderObject } from "./renderObject";
|
import { renderObject } from "./renderObject";
|
||||||
|
|
||||||
function useMission(name: string) {
|
function useMission(name: string) {
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import { KeyboardControls } from "@react-three/drei";
|
|
||||||
|
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
|
import { Vector3 } from "three";
|
||||||
import { useFrame, useThree } from "@react-three/fiber";
|
import { useFrame, useThree } from "@react-three/fiber";
|
||||||
import { useKeyboardControls } from "@react-three/drei";
|
import { KeyboardControls, useKeyboardControls } from "@react-three/drei";
|
||||||
import { PointerLockControls } from "three-stdlib";
|
import { PointerLockControls } from "three-stdlib";
|
||||||
import { useSettings } from "./SettingsProvider";
|
import { useSettings } from "./SettingsProvider";
|
||||||
import { Vector3 } from "three";
|
|
||||||
|
|
||||||
enum Controls {
|
enum Controls {
|
||||||
forward = "forward",
|
forward = "forward",
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import React, { useContext, useEffect, useMemo, useState } from "react";
|
import React, { useContext, useEffect, useMemo, useState } from "react";
|
||||||
import { PerspectiveCamera } from "three";
|
|
||||||
|
|
||||||
const SettingsContext = React.createContext(null);
|
const SettingsContext = React.createContext(null);
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ConsoleObject } from "@/src/mission";
|
import { ConsoleObject } from "../mission";
|
||||||
import { renderObject } from "./renderObject";
|
import { renderObject } from "./renderObject";
|
||||||
|
|
||||||
export function SimGroup({ object }: { object: ConsoleObject }) {
|
export function SimGroup({ object }: { object: ConsoleObject }) {
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { ConsoleObject, getProperty } from "@/src/mission";
|
|
||||||
import { useSettings } from "./SettingsProvider";
|
|
||||||
import { Suspense, useMemo, useEffect, useRef } from "react";
|
import { Suspense, useMemo, useEffect, useRef } from "react";
|
||||||
import { BASE_URL, getUrlForPath, loadDetailMapList } from "@/src/loaders";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useCubeTexture } from "@react-three/drei";
|
import { useCubeTexture } from "@react-three/drei";
|
||||||
import { Color, ShaderMaterial, BackSide } from "three";
|
import { Color, ShaderMaterial, BackSide } from "three";
|
||||||
|
import { ConsoleObject, getProperty } from "../mission";
|
||||||
|
import { useSettings } from "./SettingsProvider";
|
||||||
|
import { BASE_URL, getUrlForPath, loadDetailMapList } from "../loaders";
|
||||||
|
|
||||||
const FALLBACK_URL = `${BASE_URL}/black.png`;
|
const FALLBACK_URL = `${BASE_URL}/black.png`;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { ConsoleObject, getProperty } from "@/src/mission";
|
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { Color } from "three";
|
import { Color } from "three";
|
||||||
|
import { ConsoleObject, getProperty } from "../mission";
|
||||||
|
|
||||||
export function Sun({ object }: { object: ConsoleObject }) {
|
export function Sun({ object }: { object: ConsoleObject }) {
|
||||||
const direction = useMemo(() => {
|
const direction = useMemo(() => {
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
import { uint16ToFloat32 } from "@/src/arrayUtils";
|
|
||||||
import { loadTerrain, terrainTextureToUrl } from "@/src/loaders";
|
|
||||||
import {
|
|
||||||
ConsoleObject,
|
|
||||||
getPosition,
|
|
||||||
getProperty,
|
|
||||||
getRotation,
|
|
||||||
getScale,
|
|
||||||
} from "@/src/mission";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { Suspense, useCallback, useMemo } from "react";
|
import { Suspense, useCallback, useMemo } from "react";
|
||||||
import { useTexture } from "@react-three/drei";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import {
|
import {
|
||||||
DataTexture,
|
DataTexture,
|
||||||
RedFormat,
|
RedFormat,
|
||||||
|
|
@ -20,11 +10,21 @@ import {
|
||||||
UnsignedByteType,
|
UnsignedByteType,
|
||||||
PlaneGeometry,
|
PlaneGeometry,
|
||||||
} from "three";
|
} from "three";
|
||||||
|
import { useTexture } from "@react-three/drei";
|
||||||
|
import { uint16ToFloat32 } from "../arrayUtils";
|
||||||
|
import { loadTerrain, terrainTextureToUrl } from "../loaders";
|
||||||
|
import {
|
||||||
|
ConsoleObject,
|
||||||
|
getPosition,
|
||||||
|
getProperty,
|
||||||
|
getRotation,
|
||||||
|
getScale,
|
||||||
|
} from "../mission";
|
||||||
import {
|
import {
|
||||||
setupColor,
|
setupColor,
|
||||||
setupMask,
|
setupMask,
|
||||||
updateTerrainTextureShader,
|
updateTerrainTextureShader,
|
||||||
} from "@/src/textureUtils";
|
} from "../textureUtils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a .ter file, used for terrain heightmap and texture info.
|
* Load a .ter file, used for terrain heightmap and texture info.
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
import { textureToUrl } from "@/src/loaders";
|
import { Suspense, useMemo } from "react";
|
||||||
|
import { useTexture } from "@react-three/drei";
|
||||||
|
import { textureToUrl } from "../loaders";
|
||||||
import {
|
import {
|
||||||
ConsoleObject,
|
ConsoleObject,
|
||||||
getPosition,
|
getPosition,
|
||||||
getProperty,
|
getProperty,
|
||||||
getRotation,
|
getRotation,
|
||||||
getScale,
|
getScale,
|
||||||
} from "@/src/mission";
|
} from "../mission";
|
||||||
import { setupColor } from "@/src/textureUtils";
|
import { setupColor } from "../textureUtils";
|
||||||
import { useTexture } from "@react-three/drei";
|
|
||||||
import { Suspense, useMemo } from "react";
|
|
||||||
|
|
||||||
export function WaterMaterial({ surfaceTexture }: { surfaceTexture: string }) {
|
export function WaterMaterial({ surfaceTexture }: { surfaceTexture: string }) {
|
||||||
const url = textureToUrl(surfaceTexture);
|
const url = textureToUrl(surfaceTexture);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ConsoleObject } from "@/src/mission";
|
import { ConsoleObject } from "../mission";
|
||||||
import { TerrainBlock } from "./TerrainBlock";
|
import { TerrainBlock } from "./TerrainBlock";
|
||||||
import { WaterBlock } from "./WaterBlock";
|
import { WaterBlock } from "./WaterBlock";
|
||||||
import { SimGroup } from "./SimGroup";
|
import { SimGroup } from "./SimGroup";
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import parser from "@/generated/mission.cjs";
|
|
||||||
import { Quaternion, Vector3 } from "three";
|
import { Quaternion, Vector3 } from "three";
|
||||||
|
import parser from "@/generated/mission.cjs";
|
||||||
|
|
||||||
const definitionComment = /^ (DisplayName|MissionTypes) = (.+)$/;
|
const definitionComment = /^ (DisplayName|MissionTypes) = (.+)$/;
|
||||||
const sectionBeginComment = /^--- ([A-Z ]+) BEGIN ---$/;
|
const sectionBeginComment = /^--- ([A-Z ]+) BEGIN ---$/;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue