-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from fwilleke80/new-features
Merge new-features
- Loading branch information
Showing
8 changed files
with
583 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,106 @@ | ||
#ifndef _FLOCKHELPERS_H_ | ||
#define _FLOCKHELPERS_H_ | ||
|
||
|
||
#define ID_OFLOCKMODIFIER 1029168 | ||
#define ID_OFLOCKREPELLER 1029184 | ||
#define ID_OFLOCKTARGET 1029185 | ||
|
||
|
||
#define COLOR_FLOCKTARGET Vector(0.5, 1.0, 0.5) | ||
#define COLOR_FLOCKREPELLER Vector(1.0, 0.3, 0.3) | ||
|
||
enum RULEFLAGS | ||
{ | ||
RULEFLAGS_NONE = 0, | ||
RULEFLAGS_CENTER = (1<<0), | ||
RULEFLAGS_NEIGHBORDIST = (1<<1), | ||
RULEFLAGS_MATCHVELO = (1<<2), | ||
RULEFLAGS_TARGET = (1<<3), | ||
RULEFLAGS_LEVELFLIGHT = (1<<4), | ||
RULEFLAGS_AVOIDGEO = (1<<5), | ||
RULEFLAGS_TURBULENCE = (1<<6), | ||
RULEFLAGS_SPEEDLIMIT = (1<<7), | ||
RULEFLAGS_REPELL = (1<<8) | ||
} ENUM_END_FLAGS(RULEFLAGS); | ||
|
||
|
||
struct TargetData | ||
{ | ||
Float32 _weight; | ||
Float32 _radius; | ||
Bool _infinite; | ||
Vector _position; | ||
|
||
TargetData() : | ||
_weight(0.0), | ||
_radius(0.0), | ||
_infinite(false), | ||
_position(0.0) | ||
{ } | ||
|
||
TargetData(Float32 weight, Float32 radius, Bool infinite, const Vector &position) : | ||
_weight(weight), _radius(radius), _infinite(infinite), _position(position) | ||
{ } | ||
}; | ||
|
||
|
||
struct RepellerData | ||
{ | ||
Float32 _weight; | ||
Float32 _radius; | ||
Vector _position; | ||
|
||
RepellerData() : | ||
_weight(0.0), | ||
_radius(0.0), | ||
_position(0.0) | ||
{ } | ||
|
||
RepellerData(Float32 weight, Float32 radius, const Vector &position) : | ||
_weight(weight), _radius(radius), _position(position) | ||
{ } | ||
}; | ||
|
||
|
||
inline void DrawSphere(BaseDraw* bd, Float32 radius) | ||
{ | ||
if (!bd) | ||
return; | ||
|
||
Matrix mc; | ||
Vector v(DC); | ||
|
||
mc.Scale(radius); | ||
bd->DrawCircle(mc); | ||
v = mc.v3; mc.v3 = mc.v2; mc.v2 = v; | ||
bd->DrawCircle(mc); | ||
v = mc.v1; mc.v1 = mc.v3; mc.v3 = v; | ||
bd->DrawCircle(mc); | ||
} | ||
|
||
|
||
inline void Draw3DCross(BaseDraw* bd, Float32 length) | ||
{ | ||
if (!bd) return; | ||
|
||
Matrix mc; | ||
Vector v(DC); | ||
|
||
bd->DrawLine(Vector(0.0, length, 0.0), Vector(0.0, -length, 0.0), 0); | ||
bd->DrawLine(Vector(length, 0.0, 0.0), Vector(-length, 0.0, 0.0), 0); | ||
bd->DrawLine(Vector(0.0, 0.0, length), Vector(0.0, 0.0, -length), 0); | ||
} | ||
|
||
#endif | ||
#ifndef FLOCKHELPERS_H__ | ||
#define FLOCKHELPERS_H__ | ||
|
||
|
||
const Int32 ID_OFLOCKMODIFIER = 1029168; | ||
const Int32 ID_OFLOCKREPELLER = 1029184; | ||
const Int32 ID_OFLOCKTARGET = 1029185; | ||
|
||
const Vector COLOR_FLOCKTARGET(0.5, 1.0, 0.5); | ||
const Vector COLOR_FLOCKREPELLER(1.0, 0.3, 0.3); | ||
|
||
|
||
/// Flags to indicate which rules are active | ||
enum RULEFLAGS | ||
{ | ||
RULEFLAGS_NONE = 0, | ||
RULEFLAGS_CENTER = (1<<0), | ||
RULEFLAGS_NEIGHBORDIST = (1<<1), | ||
RULEFLAGS_MATCHVELO = (1<<2), | ||
RULEFLAGS_TARGET = (1<<3), | ||
RULEFLAGS_LEVELFLIGHT = (1<<4), | ||
RULEFLAGS_AVOIDGEO = (1<<5), | ||
RULEFLAGS_TURBULENCE = (1<<6), | ||
RULEFLAGS_SPEEDLIMIT = (1<<7), | ||
RULEFLAGS_REPELL = (1<<8) | ||
} ENUM_END_FLAGS(RULEFLAGS); | ||
|
||
|
||
/// Data for a FlockTarget | ||
struct TargetData | ||
{ | ||
Float _weight; ///< Weight of this target | ||
Float _radius; ///< Radius of this target | ||
Float _radiusI; ///< Inverted _radius (for performance reasons) | ||
Bool _infinite; ///< Is target radius infinite? | ||
Vector _position; ///< Global position of target | ||
|
||
TargetData() : | ||
_weight(0.0), | ||
_radius(0.0), | ||
_infinite(false), | ||
_position(0.0) | ||
{ } | ||
|
||
TargetData(Float weight, Float radius, Bool infinite, const Vector &position) : | ||
_weight(weight), | ||
_radius(radius), | ||
_infinite(infinite), | ||
_position(position) | ||
{ } | ||
}; | ||
|
||
|
||
/// Data for a FlockRepeller | ||
struct RepellerData | ||
{ | ||
Float _weight; ///< Weight of this repeller | ||
Float _radius; ///< Radius of this repeller | ||
Float _radiusI; ///< Inverted _radius (for performance reasons) | ||
Vector _position; ///< Global position of repeller | ||
|
||
RepellerData() : | ||
_weight(0.0), | ||
_radius(0.0), | ||
_position(0.0) | ||
{ } | ||
|
||
RepellerData(Float weight, Float radius, const Vector &position) : | ||
_weight(weight), | ||
_radius(radius), | ||
_position(position) | ||
{ } | ||
}; | ||
|
||
|
||
inline void DrawSphere(BaseDraw *bd, Float radius) | ||
{ | ||
if (!bd) | ||
return; | ||
|
||
Matrix mc; | ||
Vector v(DC); | ||
|
||
mc.Scale(radius); | ||
bd->DrawCircle(mc); | ||
v = mc.v3; mc.v3 = mc.v2; mc.v2 = v; | ||
bd->DrawCircle(mc); | ||
v = mc.v1; mc.v1 = mc.v3; mc.v3 = v; | ||
bd->DrawCircle(mc); | ||
} | ||
|
||
|
||
inline void Draw3DCross(BaseDraw *bd, Float length) | ||
{ | ||
if (!bd) | ||
return; | ||
|
||
Matrix mc; | ||
Vector v(DC); | ||
|
||
bd->DrawLine(Vector(0.0, length, 0.0), Vector(0.0, -length, 0.0), 0); | ||
bd->DrawLine(Vector(length, 0.0, 0.0), Vector(-length, 0.0, 0.0), 0); | ||
bd->DrawLine(Vector(0.0, 0.0, length), Vector(0.0, 0.0, -length), 0); | ||
} | ||
|
||
#endif // FLOCKHELPERS_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
#include "c4d.h" | ||
#include "main.h" | ||
|
||
|
||
#define PLUGIN_VERSION String("0.7") | ||
|
||
|
||
Bool PluginStart() | ||
{ | ||
GePrint("FlockModifier " + PLUGIN_VERSION); | ||
|
||
if (!RegisterFlockModifier()) | ||
return false; | ||
if (!RegisterFlockTarget()) | ||
return false; | ||
if (!RegisterFlockRepeller()) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
void PluginEnd() | ||
{ } | ||
|
||
Bool PluginMessage(Int32 id, void *data) | ||
{ | ||
switch (id) | ||
{ | ||
case C4DPL_INIT_SYS: | ||
return resource.Init(); // don't start plugin without resource | ||
|
||
case C4DMSG_PRIORITY: | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
#include "c4d.h" | ||
#include "main.h" | ||
|
||
|
||
#define PLUGIN_VERSION String("FlockModifier 0.7.5") | ||
|
||
|
||
Bool PluginStart() | ||
{ | ||
GePrint(PLUGIN_VERSION); | ||
|
||
if (!RegisterFlockModifier()) | ||
return false; | ||
if (!RegisterFlockTarget()) | ||
return false; | ||
if (!RegisterFlockRepeller()) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
void PluginEnd() | ||
{ | ||
} | ||
|
||
Bool PluginMessage(Int32 id, void *data) | ||
{ | ||
switch (id) | ||
{ | ||
case C4DPL_INIT_SYS: | ||
return resource.Init(); // don't start plugin without resource | ||
|
||
case C4DMSG_PRIORITY: | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#ifndef _MAIN_H | ||
#define _MAIN_H | ||
#ifndef MAIN_H__ | ||
#define MAIN_H__ | ||
|
||
#include "c4d.h" | ||
|
||
Bool RegisterFlockModifier(); | ||
Bool RegisterFlockTarget(); | ||
Bool RegisterFlockRepeller(); | ||
|
||
#endif | ||
#endif // MAIN_H__ |
Oops, something went wrong.