Changeset 1501
 Timestamp:
 Jun 20, 2012, 4:57:35 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/orbital/Lolnament.h
r1500 r1501 45 45 }; 46 46 47 struct Point_infos_Part48 { 49 Point_infos_Part(int useage_index, vec3 offset_pos, vec3 offset_rot, float offset_scale=.0f, vec3 offset_scale_3d=vec3(.0f), float damp_up=.0f, float damp_down=.0f)50 { 51 m_useage _index= useage_index;47 struct point_infos_Part 48 { 49 point_infos_Part(int useage_index, vec3 offset_pos, vec3 offset_rot, float offset_scale=.0f, vec3 offset_scale_3d=vec3(.0f), float damp_up=.0f, float damp_down=.0f) 50 { 51 m_useage = useage_index; 52 52 m_point_infos =work_infos(offset_pos, offset_rot, offset_scale, offset_scale_3d, damp_up, damp_down); 53 53 } 54 54 55 int m_useage _index;55 int m_useage; 56 56 work_infos m_point_infos; 57 }; 58 59 #define BLD_SPHERE 0 //influence is calculated as a sphere interpolation 60 #define BLD_SQUARE 1 //influence is calculated as a max of each vec3() component 61 62 struct influencing_point_infos 63 { 64 influencing_point_infos(int useage, vec3 position, float blend) 65 { 66 m_useage = useage; 67 m_position = position; 68 m_blend = blend; 69 } 70 71 int m_useage; 72 vec3 m_position; 73 float m_blend; 57 74 }; 58 75 … … 107 124 struct influence_infos 108 125 { 109 influence_infos(float step, const bool ignore_step_ up=false, const bool ignore_step_down=false, const int method=INF_DEFAULT)126 influence_infos(float step, const bool ignore_step_down=false, const bool ignore_step_up=false, const int method=INF_DEFAULT) 110 127 { 111 128 //Empty struct … … 118 135 }; 119 136 120 inline influence_infos& operator<<( Point_infos_Part const &added_part)121 { 122 if (added_part.m_useage _index >= OFF_DEF && added_part.m_useage_index< MAX_OFF)137 inline influence_infos& operator<<(point_infos_Part const &added_part) 138 { 139 if (added_part.m_useage >= OFF_DEF && added_part.m_useage < MAX_OFF) 123 140 { 124 int i = added_part.m_useage _index;141 int i = added_part.m_useage; 125 142 m_offset_pos[i] = added_part.m_point_infos.m_pos; 126 143 m_offset_rot[i] = added_part.m_point_infos.m_rot; … … 161 178 162 179 m_influence_list << (influence_infos(0.0f, false, false, INF_WAVE) 163 << Point_infos_Part(OFF_DEF, vec3(.0f), vec3(.0f), .0f, vec3(.0f), .0f, 1.2f));164 m_influence_list << (influence_infos(0.3f, false, true)165 << Point_infos_Part(OFF_DEF, vec3(.0f, 40.0f, .0f), vec3(.0f, 90.0f, .0f)));166 m_influence_list << (influence_infos(0.7f, false, true)167 << Point_infos_Part(OFF_DEF, vec3(.0f, 40.0f, .0f), vec3(.0f, 90.0f, .0f)));180 << point_infos_Part(OFF_DEF, vec3(.0f), vec3(.0f), .0f, vec3(.0f), .0f, 1.2f)); 181 m_influence_list << (influence_infos(0.3f, true, false) 182 << point_infos_Part(OFF_DEF, vec3(.0f, 40.0f, .0f), vec3(.0f, 90.0f, .0f))); 183 m_influence_list << (influence_infos(0.7f, true, false) 184 << point_infos_Part(OFF_DEF, vec3(.0f, 40.0f, .0f), vec3(.0f, 90.0f, .0f))); 168 185 m_influence_list << (influence_infos(1.0f) 169 << Point_infos_Part(OFF_DEF, vec3(.0f, 80.0f, .0f), vec3(.0f, .0f, 90.0f), .0f, vec3(2.0f, .0f, .0f)) 170 << Point_infos_Part(RND_MIN, vec3(40.0f, .0f, 40.0f), vec3(.0f)) 171 << Point_infos_Part(RND_MAX, vec3(40.0f, .0f, 40.0f), vec3(.0f))); 186 << point_infos_Part(OFF_DEF, vec3(.0f, 80.0f, .0f), vec3(.0f, .0f, 90.0f), .0f, vec3(2.0f, .0f, .0f)) 187 /* 188 << point_infos_Part(RND_MIN, vec3(40.0f, .0f, 40.0f), vec3(.0f)) 189 << point_infos_Part(RND_MAX, vec3(40.0f, .0f, 40.0f), vec3(.0f))*/ 190 ); 172 191 173 192 vec3 default_offset = vec3((float)DEF_X, (float)DEF_Y, (float)DEF_Z) * (float)DEF_SIZE * 0.5f; … … 199 218 debug_point_angle = M_PI * 2.0f; 200 219 201 m_influence_point_list << vec4(cos(debug_point_angle) * DEF_X * DEF_SIZE * 0.3f, 0, sin(debug_point_angle) * DEF_Z * DEF_SIZE * 0.3f, 1.0f); 220 m_influence_point_list << influencing_point_infos(BLD_SPHERE, vec3(cos(debug_point_angle) * DEF_X, 0, sin(debug_point_angle) * DEF_Z) * DEF_SIZE * 0.3f, 1.0f); 221 m_influence_point_list << influencing_point_infos(BLD_SQUARE, vec3(cos(debug_point_angle) * DEF_X, 0, sin(debug_point_angle) * DEF_Z) * DEF_SIZE * 0.3f, 1.0f); 202 222 203 223 ComputeInfluenceValues(); … … 211 231 { 212 232 m_point_list[i].m_influence_previous = m_point_list[i].m_influence; 213 m_point_list[i].m_influence = 0.0f; 233 234 float cur_blend = 0.0f; 214 235 for (int j=0; j < m_influence_point_list.Count(); j++) 215 m_point_list[i].m_influence = max(m_point_list[i].m_influence, 1.0f  min(1.0f, max(0.0f, length(m_point_list[i].m_base_pos  m_influence_point_list[j].xyz)  DEF_INF_MAX) / DEF_INF_BLEND)); 236 { 237 float new_blend = 0.0f; 238 switch (m_influence_point_list[j].m_useage) 239 { 240 case BLD_SPHERE: 241 { 242 new_blend = 1.0f  min(1.0f, max(0.0f, length(m_point_list[i].m_base_pos  m_influence_point_list[j].m_position)  DEF_INF_MAX) / DEF_INF_BLEND); 243 break; 244 } 245 case BLD_SQUARE: 246 { 247 vec3 point_diff = m_point_list[i].m_base_pos  m_influence_point_list[j].m_position; 248 point_diff = vec3(abs(point_diff.x), abs(point_diff.y), abs(point_diff.z)); 249 250 new_blend = min(1.0f  min(1.0f, max(0.0f, point_diff.z  DEF_INF_MAX) / DEF_INF_BLEND), 251 min(1.0f  min(1.0f, max(0.0f, point_diff.y  DEF_INF_MAX) / DEF_INF_BLEND), 252 1.0f  min(1.0f, max(0.0f, point_diff.x  DEF_INF_MAX) / DEF_INF_BLEND))); 253 break; 254 } 255 default: 256 { 257 break; 258 } 259 }; 260 261 //cur_blend = max(cur_blend, 1.0f  min(1.0f, max(0.0f, length(m_point_list[i].m_base_pos  m_influence_point_list[j].m_position)  DEF_INF_MAX) / DEF_INF_BLEND)); 262 cur_blend = max(cur_blend, new_blend); 263 } 264 265 m_point_list[i].m_influence = cur_blend; 216 266 } 217 267 } … … 229 279 for (int j=0; j < m_influence_list.Count(); j++) 230 280 { 281 influence_infos &tmp = m_influence_list[j]; 231 282 if (m_influence_list[j].m_step <= m_point_list[i].m_influence && 232 283 m_influence_list[j].m_step > step_a && … … 338 389 //List of influence steps 339 390 Array<influence_infos> m_influence_list; 340 341 Array< vec4> m_influence_point_list;391 //List of currently influencing points 392 Array<influencing_point_infos> m_influence_point_list; 342 393 343 394 float wave_angle;
Note: See TracChangeset
for help on using the changeset viewer.