Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 325 vs 326 for /trunk/Source Code/Environment/Vegetation/Vegetation.cpp

Diff revisions: vs.
  @@ -60,16 +60,18 @@
60 60 _cullShader = CreateResource<ShaderProgram>(instanceCullShader);
61 61 }
62 62
63 - Vegetation::~Vegetation(){
63 + Vegetation::~Vegetation() {
64 64 PRINT_FN(Locale::get("UNLOAD_VEGETATION_BEGIN"), getName().c_str());
65 65 _stopLoadingRequest = true;
66 66 U32 timer = 0;
67 - while(!_threadedLoadComplete){
68 - // wait for the loading thread to finish first;
69 - std::this_thread::sleep_for(std::chrono::milliseconds(10));
70 - timer += 10;
71 - if (timer > 1500) break;
72 - }
67 + while (!_threadedLoadComplete){
68 + // wait for the loading thread to finish first;
69 + std::this_thread::sleep_for(std::chrono::milliseconds(10));
70 + timer += 10;
71 + if (timer > 3000) {
72 + break;
73 + }
74 + }
73 75 assert(_threadedLoadComplete);
74 76 _grassPositions.clear();
75 77 RemoveResource(_cullShader);
  @@ -116,7 +118,8 @@
116 118 setMaterial(vegMaterial);
117 119
118 120 Kernel* kernel = Application::getInstance().getKernel();
119 - _generateVegetation.reset(kernel->AddTask(0, true, true, DELEGATE_BIND(&Vegetation::generateGrass, this), DELEGATE_BIND(&Vegetation::uploadGrassData, this)));
121 + _generateVegetation.reset(kernel->AddTask(0, 1, DELEGATE_BIND(&Vegetation::generateGrass, this), DELEGATE_BIND(&Vegetation::uploadGrassData, this)));
122 + _generateVegetation->startTask();
120 123 setState(RES_LOADED);
121 124 }
122 125
  @@ -367,9 +370,9 @@
367 370 densityFactor += 0.1f;
368 371 for (F32 width = 0; width < chunkSize.x - densityFactor; width += densityFactor){
369 372 for (F32 height = 0; height < chunkSize.y - densityFactor; height += densityFactor){
370 - if (_stopLoadingRequest)
371 - continue;
372 -
373 + if (_stopLoadingRequest) {
374 + continue;
375 + }
373 376 F32 x = width + random(densityFactor) + chunkPos.x;
374 377 F32 y = height + random(densityFactor) + chunkPos.y;
375 378 CLAMP<F32>(x, 0.0f, (F32)mapWidth - 1.0f);
  @@ -378,14 +381,17 @@
378 381 F32 y_fac = y / _map.dimensions().height;
379 382
380 383 I32 map_color = _map.getColor((U16)x, (U16)y)[index];
381 - if (map_color < 150) continue;
382 -
384 + if (map_color < 150) {
385 + continue;
386 + }
383 387 const vec3<F32>& P = _terrain->getPosition(x_fac, y_fac);
384 - if (P.y < waterLevel) continue;
385 -
388 + if (P.y < waterLevel) {
389 + continue;
390 + }
386 391 const vec3<F32>& N = _terrain->getNormal(x_fac, y_fac);
387 - if (N.y < 0.7f) continue;
388 -
392 + if (N.y < 0.7f) {
393 + continue;
394 + }
389 395 #pragma omp critical
390 396 {
391 397 /*position.set(P);