This repository was archived by the owner on Oct 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
New features that would need a compiler change #36
Copy link
Copy link
Open
Description
In this issue I want to collect new features that would require a compiler change, as the compiler only infers certain types from a [glsl| |] block.
The types that are currently supported are:
| GLSL | Elm |
|---|---|
| float | Float |
| int | Int |
| vec2 | Math.Vector2.Vec2 |
| vec3 | Math.Vector3.Vec3 |
| vec4 | Math.Vector3.Vec4 |
| mat4 | Math.Matrix4.Mat4 |
| sampler2D | WebGL.Texture |
Things that would be nice to have:
| GLSL | Elm | Reason |
|---|---|---|
| bool | Bool | To toggle stuff on and off |
| mat3 | Math.Matrix.Mat3 | For 2d games, normal matrix for 3d shading, etc. |
| mat2 | Math.Matrix.Mat2 | |
| samplerCube | WebGL.CubeTexture | For reflections, etc. |
| type name[] | Array.Array a | Arrays are needed for multiple light sources, GPU skinning, etc. |
| struct Name {..} | type alias Name {..} | Structs are nice for grouping. Click here for more info. |
The relevant lines for the compiler are here.
Interestingly, we can actually pass in types that the compiler doesn't support and it still works. However, the compiler won't be able to infer types and catch errors this way.
(To confirm this statement, try passing in a Bool. It works as expected, but you don't get a compiler error if you leave it out or pass a String instead.)
Once it's clear what types we actually need, I could open an issue or a pull request to the compiler.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels