summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorreduz <juan@okamstudio.com>2016-12-30 08:35:54 -0300
committerreduz <juan@okamstudio.com>2016-12-30 08:35:54 -0300
commitf4a56e7782526e5e20a4351c4c293a7b4f020acd (patch)
tree8a08474f43dbd7e2204bc9688619f27532056339 /scene/3d
parent289bc881aaec35cc127256137abc7dcf116afd48 (diff)
begin work on new particle system
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/gi_probe.cpp11
-rw-r--r--scene/3d/gi_probe.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 24ed12027e..de2d9c1b98 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -620,8 +620,10 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V
if (p_baker->bake_cells[p_idx].childs[i]==Baker::CHILD_EMPTY) {
//sub cell must be created
- p_baker->bake_cells[p_idx].childs[i]=p_baker->bake_cells.size();
+ uint32_t child_idx = p_baker->bake_cells.size();
+ p_baker->bake_cells[p_idx].childs[i]=child_idx;
p_baker->bake_cells.resize( p_baker->bake_cells.size() + 1);
+ p_baker->bake_cells[child_idx].level=p_level+1;
}
@@ -1124,7 +1126,12 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){
w32[ofs++]=norm;
}
- w32[ofs++]=uint32_t(baker.bake_cells[i].alpha*65535.0);
+ {
+ uint16_t alpha = CLAMP(uint32_t(baker.bake_cells[i].alpha*65535.0),0,65535);
+ uint16_t level = baker.bake_cells[i].level;
+
+ w32[ofs++] = (uint32_t(level)<<16)|uint32_t(alpha);
+ }
}
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index aea01b5367..ca882856cf 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -73,6 +73,7 @@ private:
float normal[3];
uint32_t used_sides;
float alpha; //used for upsampling
+ int level;
Cell() {
for(int i=0;i<8;i++) {
@@ -86,6 +87,7 @@ private:
}
alpha=0;
used_sides=0;
+ level=0;
}
};