Skip to content
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

Dynamic LOD switching #324

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
5 changes: 4 additions & 1 deletion libs/ff-scene/source/components/CRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { Mesh } from "three";
import * as constants from "three/src/constants";
import * as constants from "three/src/constants.js";

import Component, { Node, ITypedEvent, types } from "@ff/graph/Component";
import CPulse, { IPulseEvent } from "@ff/graph/components/CPulse";
Expand Down Expand Up @@ -66,6 +66,7 @@ export default class CRenderer extends Component
static readonly outs = {
maxTextureSize: types.Integer("Caps.MaxTextureSize"),
maxCubemapSize: types.Integer("Caps.MaxCubemapSize"),
framerate: types.Integer("Renderer.Framerate"),
};

ins = this.addInputs(CRenderer.ins);
Expand Down Expand Up @@ -221,7 +222,9 @@ export default class CRenderer extends Component

this.views.forEach(view => {
if(!view.renderer.xr.isPresenting) {
const start = (performance || Date).now();
view.render();
this.outs.framerate.value = this.outs.framerate.value *0.9 + 0.1*1000/((performance || Date).now() -start);
}
});

Expand Down
147 changes: 76 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions source/client/applications/coreTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import NVNode from "../nodes/NVNode";
import CVAmbientLight from "client/components/lights/CVAmbientLight";
import CVHemisphereLight from "client/components/lights/CVHemisphereLight";
import CVRectLight from "client/components/lights/CVRectLight";
import CVDerivativesController from "client/components/CVDerivativesController";


////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -129,6 +130,7 @@ const types = [
CVViewer,
CVReader,
CVOrbitNavigation,
CVDerivativesController,
CVBackground,
CVFloor,
CVGrid,
Expand Down
Loading