www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D, Game Development, GLSL, Math

reply Void-995 <void995 gmail.com> writes:
(Void-995) Hi, everyone. I'm pretty excited with what have D to 
offer for game development, especially meta programming, traits, 
object.factory, signals and bunch of other neat things that may 
save a lot of time. Also, i saw support for vector data types and 
simd, which sounds awesome. The question is, can i use simd as 
base to extend it's syntax for making something like GLM for C++? 
I mean extending existing types with new operators and such to 
have GLSL/HLSL like syntax for basis math operation in D? Maybe 
someone did that already?
Jul 01 2017
next sibling parent reply drug <drug2004 bk.ru> writes:
01.07.2017 22:07, Void-995 пишет:
 (Void-995) Hi, everyone. I'm pretty excited with what have D to offer 
 for game development, especially meta programming, traits, 
 object.factory, signals and bunch of other neat things that may save a 
 lot of time. Also, i saw support for vector data types and simd, which 
 sounds awesome. The question is, can i use simd as base to extend it's 
 syntax for making something like GLM for C++? I mean extending existing 
 types with new operators and such to have GLSL/HLSL like syntax for 
 basis math operation in D? Maybe someone did that already?
Look at gfm https://code.dlang.org/packages/gfm
Jul 01 2017
parent reply Void-995 <void995 gmail.com> writes:
On Saturday, 1 July 2017 at 19:16:12 UTC, drug wrote:
 01.07.2017 22:07, Void-995 пишет:
 (Void-995) Hi, everyone. I'm pretty excited with what have D 
 to offer for game development, especially meta programming, 
 traits, object.factory, signals and bunch of other neat things 
 that may save a lot of time. Also, i saw support for vector 
 data types and simd, which sounds awesome. The question is, 
 can i use simd as base to extend it's syntax for making 
 something like GLM for C++? I mean extending existing types 
 with new operators and such to have GLSL/HLSL like syntax for 
 basis math operation in D? Maybe someone did that already?
Look at gfm https://code.dlang.org/packages/gfm
Looking good, but I'm thinking more about 1:1 GLSL syntax (main reason - rapid prototype of GLSL/HLSL/OpenCL in D and code portability back and forward basing on usage) and heavy depending on SIMD. Just math and nothing else. Also may be a nice excersise for myself.
Jul 01 2017
next sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Saturday, 1 July 2017 at 19:23:57 UTC, Void-995 wrote:
 On Saturday, 1 July 2017 at 19:16:12 UTC, drug wrote:
 01.07.2017 22:07, Void-995 пишет:
 (Void-995) Hi, everyone. I'm pretty excited with what have D 
 to offer for game development, especially meta programming, 
 traits, object.factory, signals and bunch of other neat 
 things that may save a lot of time. Also, i saw support for 
 vector data types and simd, which sounds awesome. The 
 question is, can i use simd as base to extend it's syntax for 
 making something like GLM for C++? I mean extending existing 
 types with new operators and such to have GLSL/HLSL like 
 syntax for basis math operation in D? Maybe someone did that 
 already?
Look at gfm https://code.dlang.org/packages/gfm
Looking good, but I'm thinking more about 1:1 GLSL syntax (main reason - rapid prototype of GLSL/HLSL/OpenCL in D and code portability back and forward basing on usage) and heavy depending on SIMD. Just math and nothing else. Also may be a nice excersise for myself.
"Changing the syntax" can be done (e.g. https://github.com/p0nce/intel-intrinsics) You'll want to look at the operator overloading that can be done in D (spec https://dlang.org/spec/operatoroverloading.html) As a side note: I'll soon be starting work on DCompute[1] again (Honours thesis due tomorrow), integrating John Colvin's CLWrap among many other things. [1]https://github.com/libmir/dcompute
Jul 01 2017
prev sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Saturday, 1 July 2017 at 19:23:57 UTC, Void-995 wrote:
 Looking good, but I'm thinking more about 1:1 GLSL syntax (main 
 reason - rapid prototype of GLSL/HLSL/OpenCL in D and code 
 portability back and forward basing on usage) and heavy 
 depending on SIMD. Just math and nothing else. Also may be a 
 nice excersise for myself.
You can just depend on the subpackage gfm:math. Is 1:1 GLSL syntax that good? In GLSL: - per-item max is just called "max" which clashes with Phobos. Most GLSL function names clash with Phobos which creates errors when both are imported. - mat3x4 is a 3 column by 4 rows types, which is kind of a trap. - vec4 does not say it's 4 floats whereas vec4f does - "lerp" might be a better name than "mix" - etc...
Jul 01 2017
prev sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Saturday, 1 July 2017 at 19:07:48 UTC, Void-995 wrote:
 can i use simd as base to extend it's syntax for making 
 something like GLM for C++?
You can use simd to implement something like GLM, but extending the syntax of SIMD will prove more difficult. vector types are a bit different in LDC and DMD, also DMD 32-bit won't support D_SIMD. https://github.com/jkrempus/pfft is the only library I know that abstracts over the varied D SIMD capabilities, and possibly work with all compilers.
Jul 01 2017