Git Product home page Git Product logo

Comments (3)

Dav1dde avatar Dav1dde commented on July 17, 2024

I don't understand your question. You want to import vec3? import gl3n.linalg : vec3

from gl3n.

joelcnz avatar joelcnz commented on July 17, 2024

I want to compile an example program. I was expecting a module called 'import gl3n.all' or some thing.

I tried including all the modules (not counting the ext ones) and got this:

Joels-MacBook-Pro:gl3n joelcnz$ dub
Performing "debug" build using dmd for x86_64.
gl3n 1.3.1: target for configuration "library" is up to date.
game ~master: building configuration "application"...
source/app.d(19,2): Error: undefined identifier 'glUniformMatrix4fv'
source/app.d(23,2): Error: undefined identifier 'glGetDoublev'
source/app.d(25,18): Error: undefined identifier 'view'
source/app.d(26,23): Error: undefined identifier 'view'
source/app.d(26,2): Error: declaration app.main.inv_view is already defined
dmd failed with exit code 1.
Joels-MacBook-Pro:gl3n joelcnz$

Here's the code:

import gl3n.linalg;
import gl3n.linalg : PI;
import gl3n.math;
import gl3n.aabb;
import gl3n.frustum;
import gl3n.interpolate;
import gl3n.plane;
import gl3n.util;

void main() {
vec4 v4 = vec4(1.0f, vec3(2.0f, 3.0f, 4.0f));
vec4 v4_2 = vec4(1.0f, vec4(1.0f, 2.0f, 3.0f, 4.0f).xyz); // "dynamic" swizzling with opDispatch
vec4 v4_3 = v4_2.xxyz; // opDispatch returns a static array which you can pass directly to the ctor of a vector!

//vec3 v3 = my_3dvec.rgb;
vec3 foo = v4.xyzzzwzyyxw.xyz; // not useful but possible!

mat4 m4fv = mat4.translation(-0.5f, -0.54f, 0.42f).rotatex(PI).rotatez(PI/2);
glUniformMatrix4fv(location, 1, GL_TRUE, m4fv.value_ptr); // yes they are row major!

alias Matrix!(double, 4, 4) mat4d;
mat4d projection;
glGetDoublev(GL_PROJECTION_MATRIX, projection.value_ptr);

mat3 inv_view = view.rotation;
mat3 inv_view = mat3(view);

mat4 m4 = mat4(vec4(1.0f, 2.0f, 3.0f, 4.0f), 5.0f, 6.0f, 7.0f, 8.0f, vec4(1,2,3,4), vec4(1,2,3,4)); 

}

from gl3n.

Dav1dde avatar Dav1dde commented on July 17, 2024

Importing everything is a code smell that's why there is no gl3n.all module. Furthermore compiling this example doesn't really makes sense, it is just a short overview of what is possible and how you would use it (e.g. glUniformMatrix4fv is an OpenGL function which has per se nothing to do with gl3n).

from gl3n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.