Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- rod Apophysis Plugin
- Copyright 2011 Branden Brown, a.k.a. zephyrtronium
- This plugin is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
- This plugin is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this plugin; if not, see <http://www.gnu.org/licenses/>.
- */
- typedef struct
- {
- double rod_blur;
- int n; double r[4];
- } Variables;
- #include "apoplugin.h"
- APO_PLUGIN("rod");
- APO_VARIABLES(
- VAR_REAL(rod_blur, 1.25),
- );
- int PluginVarPrepare(Variation* vp)
- {
- VAR(n) = 0;
- VAR(r)[0] = random01();
- VAR(r)[1] = random01();
- VAR(r)[2] = random01();
- VAR(r)[3] = random01();
- return TRUE;
- }
- int PluginVarCalc(Variation* vp)
- {
- double r, sr, cr;
- fsincos(random01() * M_2PI, &sr, &cr);
- r = VAR(rod_blur) * (VAR(r)[0] + VAR(r)[1] + VAR(r)[2] + VAR(r)[3] - 2.0);
- VAR(r)[VAR(n)] = random01();
- VAR(n) = VAR(n) + 1 & 3;
- FPx += VVAR * sin(FTx + r * sr);
- FPy += r + FTy;
- FPz += VVAR * cos(FTx + r * cr);
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement