On my system(s), xglobe's stars show up in diagonal bands. I can only
conclude that rand() is not very random. This patch makes xglobe use random() instead, and does a randomdev() in main() for good measure. Approved by: kris
This commit is contained in:
parent
fc9e13fd5d
commit
83dc615256
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=38681
1 changed files with 47 additions and 0 deletions
47
astro/xglobe/files/patch-random
Normal file
47
astro/xglobe/files/patch-random
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
--- earthapp.cpp.orig Sat Feb 24 10:13:10 2001
|
||||||
|
+++ earthapp.cpp Sat Feb 24 10:13:29 2001
|
||||||
|
@@ -937,8 +937,8 @@
|
||||||
|
|
||||||
|
void EarthApplication::randomPosition()
|
||||||
|
{
|
||||||
|
- view_lat = ((rand()%30001)/30000.)*180. - 90.;
|
||||||
|
- view_long = ((rand()%30001)/30000.)*360. - 180.;
|
||||||
|
+ view_lat = ((random()%30001)/30000.)*180. - 90.;
|
||||||
|
+ view_long = ((random()%30001)/30000.)*360. - 180.;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------*/
|
||||||
|
--- renderer.cpp.orig Sat Feb 24 10:12:53 2001
|
||||||
|
+++ renderer.cpp Sat Feb 24 10:13:04 2001
|
||||||
|
@@ -1562,9 +1562,9 @@
|
||||||
|
|
||||||
|
for(int i=0; i<numstars; i++)
|
||||||
|
{
|
||||||
|
- x = rand() % renderedImage->width();
|
||||||
|
- y = rand() % renderedImage->height();
|
||||||
|
- brightness = 150+ (rand() % 106);
|
||||||
|
+ x = random() % renderedImage->width();
|
||||||
|
+ y = random() % renderedImage->height();
|
||||||
|
+ brightness = 150+ (random() % 106);
|
||||||
|
p = (unsigned int *)renderedImage->scanLine(y);
|
||||||
|
p += x;
|
||||||
|
*p = qRgb(brightness, brightness, brightness);
|
||||||
|
--- main.cpp.orig Tue Jul 13 10:32:55 1999
|
||||||
|
+++ main.cpp Sat Feb 24 10:14:56 2001
|
||||||
|
@@ -24,6 +24,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <qstring.h>
|
||||||
|
#include "config.h"
|
||||||
|
@@ -36,6 +37,8 @@
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
EarthApplication myApp(argc, argv);
|
||||||
|
+
|
||||||
|
+ srandomdev();
|
||||||
|
|
||||||
|
#ifdef WITH_QIMAGEIO
|
||||||
|
qInitImageIO();
|
Loading…
Reference in a new issue