FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TF2-Source-Code/tf2_src/mathlib/datagen.pl at master · sr2echa/TF2-Source-Code · GitHub
sr2echa
/
TF2-Source-Code
Public
Notifications
You must be signed in to change notification settings
Fork
22
Star
81
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TF2-Source-Code
/
tf2_src
/
mathlib
/
datagen.pl
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (51 loc) · 1.74 KB
Breadcrumbs
TF2-Source-Code
/
tf2_src
/
mathlib
/
datagen.pl
Copy path
File metadata and controls
63 lines (51 loc) · 1.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
! perl
use
Text::Wrap;
#
generate output data for noise generators
srand
(31456);
print
<<END
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose: static data for noise() primitives.
//
//
\$
Workfile:
\$
//
\$
NoKeywords:
\$
//=============================================================================//
//
// **** DO NOT EDIT THIS FILE. GENERATED BY DATAGEN.PL ****
//
END
;
@perm_a
=0..255;
&fisher_yates_shuffle(\
@perm_a
);
$Text::Wrap::Columns
=78;
$Text::Wrap::break
=
"
,
"
;
$Text::Wrap::separator
=
"
,
\n
"
;
print
"
static int perm_a[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
&fisher_yates_shuffle(\
@perm_a
);
print
"
static int perm_b[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
&fisher_yates_shuffle(\
@perm_a
);
print
"
static int perm_c[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
&fisher_yates_shuffle(\
@perm_a
);
print
"
static int perm_d[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
for
(
$i
=0;
$i
<256;
$i
++)
{
$float_perm
=(1.0/255.0)*
$perm_a
[
$i
];
$perm_a
[
$i
] =
sprintf
(
"
%f
"
,
$float_perm
);
}
&fisher_yates_shuffle(\
@perm_a
);
print
"
static float impulse_xcoords[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
&fisher_yates_shuffle(\
@perm_a
);
print
"
static float impulse_ycoords[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
&fisher_yates_shuffle(\
@perm_a
);
print
"
static float impulse_zcoords[]={
\n
"
,wrap(
'
'
,
'
'
,
join
(
"
,
"
,
@perm_a
)),
"
\n
};
\n\n
"
;
#
fisher_yates_shuffle( \@array ) : generate a random permutation
#
of @array in place
sub
fisher_yates_shuffle
{
my
$array
=
shift
;
my
$i
;
for
(
$i
=
@$array
; --
$i
; ) {
my
$j
=
int
rand
(
$i
+1);
next
if
$i
==
$j
;
@$array
[
$i
,
$j
] =
@$array
[
$j
,
$i
];
}
}
Back
|
FazBrowse Home
|
New Git URL