Documentation ¶
Index ¶
- func CalculateCenter(v []Vertex) [2]float32
- func CreateVertexBuffer(device *wgpu.Device, vertices []Vertex, width float32, height float32) *wgpu.Buffer
- func ScreenToNDC(x, y, screenWidth, screenHeight float32) [3]float32
- type Vertex
- func ConvertVerticesToNDC(vertices []Vertex, screenWidth, screenHeight float32) []Vertex
- func MakeCircle(cx, cy int, radius float32, c color.Color, segments int) []Vertex
- func MakeLine(x1, y1, x2, y2 int, width float32, c color.Color) []Vertex
- func MakePolygon(cx, cy int, width float32, c color.Color, sides int) []Vertex
- func MakePolygonFromVertices(cx, cy int, width float32, vertices []graphics.Vertex) []Vertex
- func MakeRectangle(x, y, width, height int, c color.Color) []Vertex
- func MakeTriangle(x1, y1, x2, y2, x3, y3 int, c color.Color) []Vertex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateCenter ¶
func CreateVertexBuffer ¶
func ScreenToNDC ¶
ScreenToNDC transforms screen space coordinates to NDC. screenWidth and screenHeight are the dimensions of the screen.
Types ¶
type Vertex ¶
type Vertex struct { Position [3]float32 // x, y, z coordinates Color [4]float32 // RGBA color TexCoords [2]float32 }
Vertex represents a single vertex in the shape.
func ConvertVerticesToNDC ¶
convertVerticesToNDC converts an array of vertices from screen space to NDC.
func MakeCircle ¶
MakeCircle creates a new Circle renderable and adds it to the RenderQueue. It returns a reference to the created Circle.
func MakeLine ¶
MakeLine creates a new Line renderable and adds it to the RenderQueue. It returns a reference to the created Line.
func MakePolygon ¶
MakePolygon creates a new Polygon renderable and adds it to the RenderQueue. It returns a reference to the created Polygon.
func MakePolygonFromVertices ¶
func MakeRectangle ¶
MakeRectangle creates a new Rectangle renderable and adds it to the RenderQueue. It returns a reference to the created Rectangle.
func MakeTriangle ¶
MakeTriangle creates a new Triangle renderable and adds it to the RenderQueue. It returns a reference to the created Triangle.