projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
glow effect
[carveJwlIkooP6JGAAIwe30JlM.git]
/
pointcloud.h
diff --git
a/pointcloud.h
b/pointcloud.h
index f29197f6e491bb13e8f1c4caac8446733be3aa1b..4775dd747fd2b18affbb708d0ac73648d2188420 100644
(file)
--- a/
pointcloud.h
+++ b/
pointcloud.h
@@
-14,9
+14,11
@@
struct pointcloud{
f64 anim_start;
f32 visibility;
enum pointcloud_anim{
f64 anim_start;
f32 visibility;
enum pointcloud_anim{
- k_pointcloud_anim_opening = 0,
- k_pointcloud_anim_hiding = 1,
- k_pointcloud_anim_idle = 2
+ k_pointcloud_anim_opening,
+ k_pointcloud_anim_hiding,
+ k_pointcloud_anim_idle_any,
+ k_pointcloud_anim_idle_open,
+ k_pointcloud_anim_idle_closed,
}
anim;
}
}
anim;
}
@@
-102,23
+104,35
@@
static void pointcloud_init(void)
shader_point_map_register();
}
shader_point_map_register();
}
+static void pointcloud_animate( enum pointcloud_anim anim )
+{
+ pointcloud.anim = anim;
+ pointcloud.anim_start = vg.time;
+}
+
+static int pointcloud_idle(void)
+{
+ if( pointcloud.anim >= k_pointcloud_anim_idle_any ) return 1;
+ else return 0;
+}
+
static void pointcloud_render( world_instance *world, camera *cam, m4x3f model )
{
static void pointcloud_render( world_instance *world, camera *cam, m4x3f model )
{
- if( pointcloud.anim
!= k_pointcloud_anim_idle
){
- f32 const k_transition =
1.0
f;
+ if( pointcloud.anim
< k_pointcloud_anim_idle_any
){
+ f32 const k_transition =
0.6
f;
f32 t = (vg.time - pointcloud.anim_start) / k_transition;
if( pointcloud.anim == k_pointcloud_anim_hiding ){
if( t > 1.0f ){
pointcloud.visibility = 0.0f;
f32 t = (vg.time - pointcloud.anim_start) / k_transition;
if( pointcloud.anim == k_pointcloud_anim_hiding ){
if( t > 1.0f ){
pointcloud.visibility = 0.0f;
- pointcloud.anim = k_pointcloud_anim_idle;
+ pointcloud.anim = k_pointcloud_anim_idle
_closed
;
}
else pointcloud.visibility = 1.0f-t;
}
else if( pointcloud.anim == k_pointcloud_anim_opening ){
if( t > 1.0f ){
pointcloud.visibility = 1.0f;
}
else pointcloud.visibility = 1.0f-t;
}
else if( pointcloud.anim == k_pointcloud_anim_opening ){
if( t > 1.0f ){
pointcloud.visibility = 1.0f;
- pointcloud.anim = k_pointcloud_anim_idle;
+ pointcloud.anim = k_pointcloud_anim_idle
_open
;
}
else pointcloud.visibility = t;
}
}
else pointcloud.visibility = t;
}