---------------------------------------------------------------------------- Start split - kick off the recursive 'createSplit' procedure ----------------------------------------------------------------------------
| 1296 | // Start split - kick off the recursive 'createSplit' procedure |
| 1297 | //---------------------------------------------------------------------------- |
| 1298 | void LightningBolt::startSplits() |
| 1299 | { |
| 1300 | |
| 1301 | for( U32 i=0; i<mMajorNodes.numNodes-1; i++ ) |
| 1302 | { |
| 1303 | if( gRandGen.randF() > 0.3f ) |
| 1304 | continue; |
| 1305 | |
| 1306 | Node node = mMajorNodes.nodeList[i]; |
| 1307 | Node node2 = mMajorNodes.nodeList[i+1]; |
| 1308 | |
| 1309 | VectorF segDir = node2.point - node.point; |
| 1310 | F32 length = segDir.len(); |
| 1311 | segDir.normalizeSafe(); |
| 1312 | |
| 1313 | VectorF newDir = MathUtils::randomDir( segDir, 20.0f, 40.0f ); |
| 1314 | Point3F newEndPoint = node.point + newDir * gRandGen.randF( 0.5f, 1.5f ) * length; |
| 1315 | |
| 1316 | |
| 1317 | createSplit( node.point, newEndPoint, 4, width * 0.30f ); |
| 1318 | } |
| 1319 | |
| 1320 | |
| 1321 | } |
| 1322 | |
| 1323 | //---------------------------------------------------------------------------- |
| 1324 | // Update |
no test coverage detected