Renamed fg_random -> sg_random.
This commit is contained in:
@@ -10,24 +10,24 @@ lib_LIBRARIES = libsgmath.a
|
|||||||
|
|
||||||
include_HEADERS = \
|
include_HEADERS = \
|
||||||
fg_memory.h \
|
fg_memory.h \
|
||||||
fg_random.h \
|
|
||||||
interpolater.hxx \
|
interpolater.hxx \
|
||||||
leastsqs.hxx \
|
leastsqs.hxx \
|
||||||
localconsts.hxx \
|
localconsts.hxx \
|
||||||
point3d.hxx \
|
point3d.hxx \
|
||||||
polar3d.hxx \
|
polar3d.hxx \
|
||||||
sg_geodesy.hxx \
|
sg_geodesy.hxx \
|
||||||
|
sg_random.h \
|
||||||
sg_types.hxx \
|
sg_types.hxx \
|
||||||
vector.hxx
|
vector.hxx
|
||||||
|
|
||||||
EXTRA_DIST = linintp2.h linintp2.inl sphrintp.h sphrintp.inl
|
EXTRA_DIST = linintp2.h linintp2.inl sphrintp.h sphrintp.inl
|
||||||
|
|
||||||
libsgmath_a_SOURCES = \
|
libsgmath_a_SOURCES = \
|
||||||
fg_random.c \
|
|
||||||
interpolater.cxx \
|
interpolater.cxx \
|
||||||
leastsqs.cxx \
|
leastsqs.cxx \
|
||||||
polar3d.cxx \
|
polar3d.cxx \
|
||||||
sg_geodesy.cxx \
|
sg_geodesy.cxx \
|
||||||
|
sg_random.c \
|
||||||
vector.cxx
|
vector.cxx
|
||||||
|
|
||||||
INCLUDES += -I$(top_srcdir) $(ZLIB_INCL)
|
INCLUDES += -I$(top_srcdir) $(ZLIB_INCL)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// fg_random.c -- routines to handle random number generation
|
// sg_random.c -- routines to handle random number generation
|
||||||
//
|
//
|
||||||
// Written by Curtis Olson, started July 1997.
|
// Written by Curtis Olson, started July 1997.
|
||||||
//
|
//
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <stdlib.h> // for random(), srandom()
|
#include <stdlib.h> // for random(), srandom()
|
||||||
#include <time.h> // for time() to seed srandom()
|
#include <time.h> // for time() to seed srandom()
|
||||||
|
|
||||||
#include "fg_random.h"
|
#include "sg_random.h"
|
||||||
|
|
||||||
#ifndef HAVE_RAND
|
#ifndef HAVE_RAND
|
||||||
# ifdef sgi
|
# ifdef sgi
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
// Seed the random number generater with time() so we don't see the
|
// Seed the random number generater with time() so we don't see the
|
||||||
// same sequence every time
|
// same sequence every time
|
||||||
void fg_srandom(void) {
|
void sg_srandom(void) {
|
||||||
// fgPrintf( FG_MATH, FG_INFO, "Seeding random number generater\n");
|
// fgPrintf( FG_MATH, FG_INFO, "Seeding random number generater\n");
|
||||||
|
|
||||||
#ifdef HAVE_RAND
|
#ifdef HAVE_RAND
|
||||||
@@ -61,7 +61,7 @@ void fg_srandom(void) {
|
|||||||
|
|
||||||
|
|
||||||
// return a random number between [0.0, 1.0)
|
// return a random number between [0.0, 1.0)
|
||||||
double fg_random(void) {
|
double sg_random(void) {
|
||||||
#ifdef HAVE_RAND
|
#ifdef HAVE_RAND
|
||||||
return(rand() / (double)RAND_MAX);
|
return(rand() / (double)RAND_MAX);
|
||||||
#else
|
#else
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// fg_random.h -- routines to handle random number generation
|
// sg_random.h -- routines to handle random number generation
|
||||||
//
|
//
|
||||||
// Written by Curtis Olson, started July 1997.
|
// Written by Curtis Olson, started July 1997.
|
||||||
//
|
//
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
|
|
||||||
#ifndef _FG_RANDOM_H
|
#ifndef _SG_RANDOM_H
|
||||||
#define _FG_RANDOM_H
|
#define _SG_RANDOM_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -33,10 +33,10 @@ extern "C" {
|
|||||||
|
|
||||||
// Seed the random number generater with time() so we don't see the
|
// Seed the random number generater with time() so we don't see the
|
||||||
// same sequence every time
|
// same sequence every time
|
||||||
void fg_srandom(void);
|
void sg_srandom(void);
|
||||||
|
|
||||||
// return a random number between [0.0, 1.0)
|
// return a random number between [0.0, 1.0)
|
||||||
double fg_random(void);
|
double sg_random(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -44,6 +44,6 @@ double fg_random(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // _FG_RANDOM_H
|
#endif // _SG_RANDOM_H
|
||||||
|
|
||||||
|
|
||||||
@@ -26,9 +26,9 @@
|
|||||||
#include <plib/sg.h>
|
#include <plib/sg.h>
|
||||||
#include <plib/ssg.h>
|
#include <plib/ssg.h>
|
||||||
|
|
||||||
#include <simgear/math/fg_random.h>
|
|
||||||
#include <simgear/math/point3d.hxx>
|
#include <simgear/math/point3d.hxx>
|
||||||
#include <simgear/math/polar3d.hxx>
|
#include <simgear/math/polar3d.hxx>
|
||||||
|
#include <simgear/math/sg_random.h>
|
||||||
|
|
||||||
#include "cloud.hxx"
|
#include "cloud.hxx"
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void SGCloudLayer::build( double s, double asl, double thickness,
|
|||||||
|
|
||||||
sgSetVec3( vertex, -size, -size, 0.0f );
|
sgSetVec3( vertex, -size, -size, 0.0f );
|
||||||
sgVec2 base;
|
sgVec2 base;
|
||||||
sgSetVec2( base, fg_random(), fg_random() );
|
sgSetVec2( base, sg_random(), sg_random() );
|
||||||
sgSetVec2( tc, base[0], base[1] );
|
sgSetVec2( tc, base[0], base[1] );
|
||||||
cl->add( color );
|
cl->add( color );
|
||||||
vl->add( vertex );
|
vl->add( vertex );
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
#include <plib/sg.h>
|
#include <plib/sg.h>
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/math/fg_random.h>
|
|
||||||
|
|
||||||
#include "dome.hxx"
|
#include "dome.hxx"
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -30,7 +30,7 @@
|
|||||||
#include <plib/sg.h>
|
#include <plib/sg.h>
|
||||||
#include <plib/ssg.h>
|
#include <plib/ssg.h>
|
||||||
|
|
||||||
#include <simgear/math/fg_random.h>
|
#include <simgear/math/sg_random.h>
|
||||||
|
|
||||||
#include "sky.hxx"
|
#include "sky.hxx"
|
||||||
|
|
||||||
@@ -328,11 +328,11 @@ void SGSky::modify_vis( float alt, float time_factor ) {
|
|||||||
if ( ratio < 1.0 ) {
|
if ( ratio < 1.0 ) {
|
||||||
if ( ! in_puff ) {
|
if ( ! in_puff ) {
|
||||||
// calc chance of entering cloud puff
|
// calc chance of entering cloud puff
|
||||||
double rnd = fg_random();
|
double rnd = sg_random();
|
||||||
double chance = rnd * rnd * rnd;
|
double chance = rnd * rnd * rnd;
|
||||||
if ( chance > 0.95 /* * (diff - 25) / 50.0 */ ) {
|
if ( chance > 0.95 /* * (diff - 25) / 50.0 */ ) {
|
||||||
in_puff = true;
|
in_puff = true;
|
||||||
puff_length = fg_random() * 2.0; // up to 2 seconds
|
puff_length = sg_random() * 2.0; // up to 2 seconds
|
||||||
puff_progression = 0.0;
|
puff_progression = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user