Skip to content

feat: Render Scene Defaults #5

Open
@mithi

Description

@mithi

Motivation

renderScene() takes in viewSettings, sceneSettings,sceneOptions and data

Scene options has a shape that is specified here https://github.com/mithi/bare-minimum-3d/blob/master/src/parameter-types.ts You have to specify a lot of color, opacity, and lineSize among others. You may not want to think about these things.

Solution

So there should be an additional alternative function than can be used:
renderSceneDefaults(viewSettings, sceneSettings, sceneOptionsBoolean, backgroundColor, theme, data)

The user should be able to override the background color should s/he wish

The user should also be able to specify a theme which is light or dark which will use the default colors and lines etc.
The user should specify which scene option elements you want to show ie

const sceneOptionsBoolean: Record<string, boolean> = {
    showWorldAxes: true,
    showEdgeAxes: true,
    showCubeAxes: true,
    showXYplane: true,
    showCrosslines: true,
    showCubeEdges: true,
}

For the sceneOptions parameter, we can use these defaults for dark mode

const edgeAxes = {
    intersectionPointColor: "#FF00FF",
    intersectionPointSize: 5,
    xColor: "#E91E63",
    yColor: "#03A9F4",
    zColor: "#CDDC39",
    lineSize: 1,
    edgeOpacity: 1.0,
}

const worldAxes = {
    intersectionPointColor: "#FFFF00",
    intersectionPointSize: 5,
    xColor: "#E91E63",
    yColor: "#03A9F4",
    zColor: "#CDDC39",
    lineSize: 3,
    edgeOpacity: 1.0,
}

const cubeAxes = {
    intersectionPointColor: "#00FF00",
    intersectionPointSize: 5,
    xColor: "#E91E63",
    yColor: "#03A9F4",
    zColor: "#CDDC39",
    lineSize: 3,
    edgeOpacity: 1.0,
}

const sceneOptions = {
    paper: { color: "#17212B", opacity: 1 },
    xyPlane: { color: "#0652DD", opacity: 0.1 },
    sceneEdges: { color: "#1e3799", opacity: 1 },
    crossLines: { color: "#079992", opacity: 1 },
    edgeAxes,
    worldAxes,
    cubeAxes,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions