Documentation ¶
Index ¶
- func ColorConversionInigoQuilez(characteristicDistance float32) func(float32) color.Color
- func ColorConversionLinearGradient(gradientLength float32, c0, c1 color.Color) func(d float32) color.Color
- func MakeGPUSDF2(s glbuild.Shader2D) (sdf gleval.SDF2, err error)
- func RenderPNGFile(filename string, sdf gleval.SDF2, picHeight int, ...) error
- func RenderShader3D(s glbuild.Shader3D, cfg RenderConfig) (err error)
- func UI(s glbuild.Shader3D, cfg UIConfig) error
- type RenderConfig
- type UIConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorConversionInigoQuilez ¶
ColorConversionInigoQuilez creates a new color conversion using Inigo Quilez's style. A good value for characteristic distance is the bounding box diagonal divided by 3. Returns red for NaN values.
func ColorConversionLinearGradient ¶
func ColorConversionLinearGradient(gradientLength float32, c0, c1 color.Color) func(d float32) color.Color
ColorConversionLinearGradient creates a color conversion function that creates a gradient centered along d=0 that extends gradientLength.
func RenderPNGFile ¶
func RenderPNGFile(filename string, sdf gleval.SDF2, picHeight int, colorConversion func(float32) color.Color) error
RenderPNGFile renders a 2D SDF as an image and saves result to a PNG file with said filename. The image width is sized automatically from the image height argument to preserve SDF aspect ratio. If a nil color conversion function is passed then one is automatically chosen.
func RenderShader3D ¶
func RenderShader3D(s glbuild.Shader3D, cfg RenderConfig) (err error)
RenderShader3D is an auxiliary function to aid users in getting setup in using gsdf quickly. Ideally users should implement their own rendering functions since applications may vary widely.
Types ¶
type RenderConfig ¶
type RenderConfig struct { STLOutput io.Writer VisualOutput io.Writer // Resolution decides the STL output resolution. It correlates with the minimum triangle size. Resolution float32 UseGPU bool Silent bool // EnableCaching uses [gleval.BlockCachedSDF3] to omit potential evaluations. // Can cut down on times for very complex SDFs, mainly when using CPU. EnableCaching bool // contains filtered or unexported fields }