sdf3ui

command module
v0.0.0-...-dd3fdab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 25 Imported by: 0

README

sdf3ui

Browser based 3D model visualizer for use with soypat/sdf package. 3 minute Youtube demo and tutorial here.

sdf3ui

Installation

Before installing make sure your GOBIN environment variable is set to a folder in your PATH.

go install github.com/soypat/sdf3ui@latest
Example of usage
  1. Create a .go extension file of any name in an empty folder. Copy the following contents into it.
  2. Run go mod init my-awesome-module in the directory followed by go mod tidy to download dependecies.
  3. Run sdf3ui thefile.go in the directory.
package main

import (
	"log"
	"os"

	"github.com/soypat/sdf"
	"github.com/soypat/sdf/form3"
	"github.com/soypat/sdf/render"
	"github.com/soypat/sdf3ui/uirender"
	"gonum.org/v1/gonum/spatial/r3"
)

func main() {
	var object sdf.SDF3
	object, _ = form3.Box(r3.Vec{4, 3, 2}, 1)
	cone, _ := form3.Cone(6, 1, 0, .1)
	union := sdf.Union3D(object, cone)
	union.SetMin(sdf.MinPoly(1, .4))
	object = union
	err := uirender.EncodeRenderer(os.Stdout, render.NewOctreeRenderer(object, 200))
	if err != nil {
		log.Fatal(err)
	}
}

example_screenshot

Build from source

If building from source run go generate to generate assets folder structure and contents.

To run app run go run . example/mybolt.go and head over to http://localhost:8080

  • sdfx-ui Real-time rendering using Faux-GL renderer for sdfx

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL