Skip to content

Commit 0eea55a

Browse files
committed
Merge branch 'develop'
2 parents 20d68de + e3cb87f commit 0eea55a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5223
-3990
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ os:
33
- linux
44
- osx
55
env:
6-
# - DMD_VER=2.065.0 DUB_VER=0.9.21
7-
- DMD_VER=2.066.0 DUB_VER=0.9.21
6+
- DMD_VER=2.066.0 DUB_VER=0.9.22
87
install:
98
- bash .travis/setup_linux.sh
109
- bash .travis/setup_osx.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Dash Logo](https://cloud.githubusercontent.com/assets/512416/2726786/6618d624-c5c2-11e3-9049-23637e5a1739.png)](https://github.com/Circular-Studios/Dash/wiki)
22

3-
# [![Build Status](http://img.shields.io/travis/Circular-Studios/Dash/develop.svg?style=flat)](https://travis-ci.org/Circular-Studios/Dash) [![Docs](http://img.shields.io/badge/docs-ddoc-yellow.svg?style=flat)](http://circular-studios.github.io/Dash/docs/latest) [![Gitter Chat](http://img.shields.io/badge/chat-gitter-brightgreen.svg?style=flat)](https://gitter.im/Circular-Studios/Dash) [![Release](http://img.shields.io/github/release/Circular-Studios/Dash.svg?style=flat)](http://code.dlang.org/packages/dash)
3+
# [![Build Status](http://img.shields.io/travis/Circular-Studios/Dash/develop.svg?style=flat)](https://travis-ci.org/Circular-Studios/Dash) [![Docs](http://img.shields.io/badge/docs-ddoc-yellow.svg?style=flat)](http://circularstudios.com/dash/api/latest/) [![Gitter Chat](http://img.shields.io/badge/chat-gitter-brightgreen.svg?style=flat)](https://gitter.im/Circular-Studios/Dash) [![Release](http://img.shields.io/github/release/Circular-Studios/Dash.svg?style=flat)](http://code.dlang.org/packages/dash)
44

55
If you're reading this page, chances are you fall into one of the following categories:
66

dub.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash",
3-
"description": "A 3D game engine in dlang.",
3+
"description": "A free and open 3D game engine written in D.",
44
"copyright": "Circular Studios 2013 - 2014",
55
"license": "MIT",
66
"homepage": "http://circularstudios.com",
@@ -21,10 +21,12 @@
2121
"derelict-fi": "~>1.0",
2222
"derelict-assimp3": "~>1.0",
2323
"dyaml": "~>0.5",
24-
"gl3n" : "~master",
25-
"dlogg": "~>0.3",
24+
"gl3n": "==1.0.0",
25+
"gfm:sdl2": "==1.3.8",
26+
"logger": "==0.3.3",
27+
"colorize": "==1.0.5",
2628
"msgpack-d": "==0.9.2",
27-
"vibe-d": "==0.7.21-alpha.4",
29+
"vibe-d": "0.7.21-rc.4",
2830
"x11": { "version": "~>1.0", "optional": true }
2931
},
3032

@@ -35,7 +37,10 @@
3537
"sourcePaths": [ "source/" ],
3638
"importPaths": [ "source/" ],
3739

38-
"versions": [ "VibeCustomMain" ],
40+
"versions": [
41+
"DashUseGl3n",
42+
"VibeCustomMain"
43+
],
3944

4045
"-ddoxFilterArgs": [ "--min-protection=Protected" ],
4146

source/dash/components/animation.d

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,62 @@
33
*/
44
module dash.components.animation;
55
import dash.core.properties;
6-
import dash.components.component;
6+
import dash.components;
77
import dash.utility;
88

99
import derelict.assimp3.assimp;
10-
import gl3n.linalg;
1110
import std.string: fromStringz;
1211
import std.conv: to;
1312

13+
mixin( registerComponents!() );
14+
1415
/**
1516
* Animation object which handles all animation specific to the gameobject
1617
*/
1718
class Animation : Component
1819
{
1920
private:
2021
/// Asset animation that the gameobject is animating based off of
21-
AssetAnimation _animationData;
22+
@ignore
23+
AnimationData _animationData;
2224
/// Current animation out of all the animations in the asset animation
25+
@ignore
2326
int _currentAnim;
2427
/// Current time of the animation
28+
@ignore
2529
float _currentAnimTime;
2630
/// Bone transforms for the current pose
27-
mat4[] _currBoneTransforms;
31+
@ignore
32+
mat4f[] _currBoneTransforms;
2833
/// If the gameobject should be animating
34+
@ignore
2935
bool _animating;
3036

3137
/// Animation to return to if _animateOnce is true
38+
@ignore
3239
int _returnAnimation;
3340
/// If the animation is animating once, then returning to _returnAnimation
41+
@ignore
3442
bool _animateOnce;
3543

3644
public:
3745
/// Bone transforms for the current pose (Passed to the shader)
3846
mixin( Property!_currBoneTransforms );
3947

48+
this()
49+
{
50+
_currentAnim = 0;
51+
_currentAnimTime = 0.0f;
52+
_animating = true;
53+
}
54+
4055
/**
4156
* Create animation object based on asset animation
4257
*/
43-
this( AssetAnimation assetAnimation )
58+
this( AnimationData assetAnimation )
4459
{
45-
_currentAnim = 0;
46-
_currentAnimTime = 0.0f;
60+
this();
4761
_animationData = assetAnimation;
48-
_animating = true;
4962
}
5063

5164
/**
@@ -107,7 +120,7 @@ public:
107120
_currentAnimTime = startAnimTime;
108121
}
109122
else
110-
logWarning( "Could not change to new animation, the animation did not exist." );
123+
warning( "Could not change to new animation, the animation did not exist." );
111124
}
112125
/**
113126
* Runs an animation once, then returns
@@ -122,7 +135,7 @@ public:
122135
_currentAnimTime = 0;
123136
}
124137
else
125-
logWarning( "Could not change to new animation, the animation did not exist." );
138+
warning( "Could not change to new animation, the animation did not exist." );
126139
}
127140

128141
/**
@@ -137,7 +150,7 @@ public:
137150
/**
138151
* Stores the animation skeleton/bones, stores the animations poses, and makes this information accessible to gameobjects
139152
*/
140-
class AssetAnimation
153+
class AnimationData : Asset
141154
{
142155
private:
143156
/// List of animations, containing all of the information specific to each
@@ -165,8 +178,10 @@ public:
165178
* mesh = Assimp mesh/bone object
166179
* nodeHierarchy = Hierarchy of bones/filler nodes used for the animation
167180
*/
168-
this( const(aiAnimation**) animations, int numAnimations, const(aiMesh*) mesh, const(aiNode*) nodeHierarchy )
181+
this( Resource res, const(aiAnimation**) animations, int numAnimations, const(aiMesh*) mesh, const(aiNode*) nodeHierarchy )
169182
{
183+
super( res );
184+
170185
for( int i = 0; i < nodeHierarchy.mNumChildren; i++)
171186
{
172187
string name = nodeHierarchy.mChildren[ i ].mName.data.ptr.fromStringz().to!string;
@@ -307,17 +322,17 @@ public:
307322
*
308323
* Returns: The boneTransforms, returned to the gameobject animation component
309324
*/
310-
mat4[] getTransformsAtTime( int animationNumber, float time )
325+
mat4f[] getTransformsAtTime( int animationNumber, float time )
311326
{
312-
mat4[] boneTransforms = new mat4[ _numberOfBones ];
327+
mat4f[] boneTransforms = new mat4f[ _numberOfBones ];
313328

314329
// Check shader/model
315330
for( int i = 0; i < _numberOfBones; i++)
316331
{
317-
boneTransforms[ i ] = mat4.identity;
332+
boneTransforms[ i ] = mat4f.identity;
318333
}
319334

320-
fillTransforms( animationSet[ animationNumber ].bonePoses, boneTransforms, boneHierarchy, time, mat4.identity );
335+
fillTransforms( animationSet[ animationNumber ].bonePoses, boneTransforms, boneHierarchy, time, mat4f.identity );
321336

322337
return boneTransforms;
323338
}
@@ -330,18 +345,18 @@ public:
330345
* time = The animations current time
331346
* parentTransform = The parents transform (which effects this bone)
332347
*/
333-
void fillTransforms( BonePose[] bonePoses, mat4[] transforms, Bone bone, float time, mat4 parentTransform )
348+
void fillTransforms( BonePose[] bonePoses, mat4f[] transforms, Bone bone, float time, mat4f parentTransform )
334349
{
335350
BonePose bonePose = bonePoses[ bone.boneNumber ];
336-
mat4 finalTransform;
351+
mat4f finalTransform;
337352
if( bonePose.positionKeys.length == 0 && bonePose.rotationKeys.length == 0 && bonePose.scaleKeys.length == 0 )
338353
{
339354
finalTransform = parentTransform * bone.nodeOffset;
340355
transforms[ bone.boneNumber ] = finalTransform * bone.offset;
341356
}
342357
else
343358
{
344-
mat4 boneTransform = mat4.identity;
359+
mat4f boneTransform = mat4f.identity;
345360

346361
if( bonePose.positionKeys.length > cast(int)time )
347362
{
@@ -351,7 +366,7 @@ public:
351366
}
352367
if( bonePose.rotationKeys.length > cast(int)time )
353368
{
354-
boneTransform = boneTransform * bonePose.rotationKeys[ cast(int)time ].to_matrix!( 4, 4 );
369+
boneTransform = boneTransform * bonePose.rotationKeys[ cast(int)time ].toMatrix!4;
355370
}
356371
if( bonePose.scaleKeys.length > cast(int)time )
357372
{
@@ -372,21 +387,21 @@ public:
372387
}
373388

374389
/**
375-
* Converts a aiVectorKey[] to vec3[].
390+
* Converts a aiVectorKey[] to vec3f[].
376391
*
377392
* Params:
378393
* quaternions = aiVectorKey[] to be converted
379394
* numKeys = Number of keys in vector array
380395
*
381396
* Returns: The vectors in vector[] format
382397
*/
383-
vec3[] convertVectorArray( const(aiVectorKey*) vectors, int numKeys )
398+
vec3f[] convertVectorArray( const(aiVectorKey*) vectors, int numKeys )
384399
{
385-
vec3[] keys;
400+
vec3f[] keys;
386401
for( int i = 0; i < numKeys; i++ )
387402
{
388403
aiVector3D vector = vectors[ i ].mValue;
389-
keys ~= vec3( vector.x, vector.y, vector.z );
404+
keys ~= vec3f( vector.x, vector.y, vector.z );
390405
}
391406

392407
return keys;
@@ -400,13 +415,13 @@ public:
400415
*
401416
* Returns: The quaternions in quat[] format
402417
*/
403-
quat[] convertQuat( const(aiQuatKey*) quaternions, int numKeys )
418+
quatf[] convertQuat( const(aiQuatKey*) quaternions, int numKeys )
404419
{
405-
quat[] keys;
420+
quatf[] keys;
406421
for( int i = 0; i < numKeys; i++ )
407422
{
408423
aiQuatKey quaternion = quaternions[ i ];
409-
keys ~= quat( quaternion.mValue.w, quaternion.mValue.x, quaternion.mValue.y, quaternion.mValue.z );
424+
keys ~= quatf( quaternion.mValue.w, quaternion.mValue.x, quaternion.mValue.y, quaternion.mValue.z );
410425
}
411426

412427
return keys;
@@ -419,9 +434,9 @@ public:
419434
*
420435
* Returns: The matrix in mat4 format
421436
*/
422-
mat4 convertAIMatrix( aiMatrix4x4 aiMatrix )
437+
mat4f convertAIMatrix( aiMatrix4x4 aiMatrix )
423438
{
424-
mat4 matrix = mat4.identity;
439+
mat4f matrix = mat4f.identity;
425440

426441
matrix[0][0] = aiMatrix.a1;
427442
matrix[0][1] = aiMatrix.a2;
@@ -446,7 +461,7 @@ public:
446461
/**
447462
* Shutdown the animation bone/pose data
448463
*/
449-
void shutdown()
464+
override void shutdown()
450465
{
451466

452467
}
@@ -465,9 +480,9 @@ public:
465480
*/
466481
class BonePose
467482
{
468-
vec3[] positionKeys;
469-
quat[] rotationKeys;
470-
vec3[] scaleKeys;
483+
vec3f[] positionKeys;
484+
quatf[] rotationKeys;
485+
vec3f[] scaleKeys;
471486
}
472487
/**
473488
* A bone in the animation, storing everything it needs
@@ -484,7 +499,7 @@ public:
484499
int boneNumber;
485500
Bone[] children;
486501

487-
mat4 offset;
488-
mat4 nodeOffset;
502+
mat4f offset;
503+
mat4f nodeOffset;
489504
}
490505
}

0 commit comments

Comments
 (0)