Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

New features that would need a compiler change #36

Open
Zinggi opened this issue Dec 21, 2016 · 3 comments
Open

New features that would need a compiler change #36

Zinggi opened this issue Dec 21, 2016 · 3 comments

Comments

@Zinggi
Copy link

Zinggi commented Dec 21, 2016

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.

@w0rm
Copy link
Member

w0rm commented Dec 21, 2016

Also, because we've moved the Texture into WebGL.Texture, it may be worth changing it in the compiler from "WebGL.Texture" to "WebGL.Texture.Texture".

@Zinggi
Copy link
Author

Zinggi commented Dec 21, 2016

I think it's also worth discussing changing Math.VectorN.VecN to WebGL.Math.VecN etc. via integrating just the constructors for these types into webgl directly. (kinda like I did here).

This way you could still use linear-algebra, but you could also use my library or some other library that operates on {x: Float, y: Float}.

@w0rm
Copy link
Member

w0rm commented Feb 26, 2017

One argument for including the linear algebra types in webgl is this issue: elm-community/linear-algebra#8 that broke the implicit contract between two libraries by changing the internal native representation.

@w0rm w0rm mentioned this issue Aug 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants