59 MaxSubdivisionLevels(0),
60 NormalizedScreenArea(0.0f)
67 MaxSubdivisionLevels(src.MaxSubdivisionLevels),
68 NormalizedScreenArea(src.NormalizedScreenArea),
69 PointLocations(src.PointLocations),
70 PointColors(src.PointColors),
71 PointWidths(src.PointWidths),
72 LineRenderer(src.LineRenderer),
73 StreakRenderer(src.StreakRenderer),
74 Personalities(src.Personalities)
84 MaxSubdivisionLevels = that.MaxSubdivisionLevels;
85 NormalizedScreenArea = that.NormalizedScreenArea;
86 PointLocations = that.PointLocations;
87 PointColors = that.PointColors;
88 PointWidths = that.PointWidths;
89 LineRenderer = that.LineRenderer;
90 StreakRenderer = that.StreakRenderer;
91 Personalities = that.Personalities;
107 LineRenderer.Reset_Line();
108 StreakRenderer.Reset_Line();
122 if (num_points < 2 || !locs) {
127 PointLocations.Delete_All();
128 for (
unsigned int i=0; i<num_points; i++) {
129 PointLocations.Add(locs[i],num_points);
137 if (num_points < 2 || !widths) {
142 PointWidths.Delete_All();
143 for (
unsigned int i=0; i<num_points; i++) {
144 PointWidths.Add(widths[i],num_points);
151 if (num_points < 2 || !colors) {
156 PointColors.Delete_All();
157 for (
unsigned int i=0; i<num_points; i++) {
158 PointColors.Add(colors[i],num_points);
167 unsigned int *personalities)
170 Personalities = personalities;
179 int locCount = PointLocations.Count();
180 int widCount = PointWidths.Count();
190 int locCount = PointLocations.Count();
191 int colCount = PointColors.Count();
216 int locCount = PointLocations.Count();
224 if (point_idx < (
unsigned int)PointLocations.Count()) {
225 PointLocations[point_idx] = location;
234 if (point_idx < (
unsigned int)PointLocations.Count()) {
235 loc.
Set(PointLocations[point_idx]);
243 PointLocations.Add(location);
248 if (point_idx < (
unsigned int)PointLocations.Count()) {
249 PointLocations.Delete(point_idx);
256 return LineRenderer.Get_Texture();
261 return LineRenderer.Get_Shader();
266 color.
Set(LineRenderer.Get_Color());
271 return LineRenderer.Get_Opacity();
276 return LineRenderer.Get_Noise_Amplitude();
281 return LineRenderer.Get_Merge_Abort_Factor();
286 return MaxSubdivisionLevels;
291 return LineRenderer.Get_Texture_Mapping_Mode();
296 return LineRenderer.Get_Texture_Tile_Factor();
301 return LineRenderer.Get_UV_Offset_Rate();
306 return LineRenderer.Is_Merge_Intersections();
311 return LineRenderer.Is_Freeze_Random();
316 return LineRenderer.Is_Sorting_Disabled();
321 return LineRenderer.Are_End_Caps_Enabled();
326 LineRenderer.Set_Texture(texture);
327 StreakRenderer.Set_Texture(texture);
332 LineRenderer.Set_Shader(shader);
333 StreakRenderer.Set_Shader(shader);
338 return LineRenderer.Get_Width();
345 LineRenderer.Set_Width(
MAX(width, 0.0f));
346 StreakRenderer.Set_Width(
MAX(width, 0.0f));
353 LineRenderer.Set_Color(color);
354 StreakRenderer.Set_Color(color);
359 LineRenderer.Set_Opacity(opacity);
360 StreakRenderer.Set_Opacity(opacity);
365 LineRenderer.Set_Noise_Amplitude(
WWMath::Fabs(amplitude));
372 LineRenderer.Set_Merge_Abort_Factor(factor);
384 LineRenderer.Set_Texture_Mapping_Mode(mode);
389 LineRenderer.Set_Texture_Tile_Factor(factor);
394 LineRenderer.Set_UV_Offset_Rate(rate);
399 LineRenderer.Set_Merge_Intersections(onoff);
404 LineRenderer.Set_Freeze_Random(onoff);
410 LineRenderer.Set_Disable_Sorting(onoff);
415 LineRenderer.Set_End_Caps(onoff);
429 int subdivision_factor = 1 << LineRenderer.Get_Current_Subdivision_Level();
430 return 2 * (PointLocations.Count() - 1) * subdivision_factor;
454 if ( !PointColors.Count() || !PointWidths.Count() )
478 unsigned int num_points = PointLocations.Count();
482 if (num_points >= 2) {
494 max_coords = PointLocations[0];
495 min_coords = PointLocations[0];
496 for (i = 1; i < num_points; i++) {
501 float enlarge_factor = LineRenderer.Get_Width() * 0.5f;
503 enlarge_offset.
Set(enlarge_factor, enlarge_factor, enlarge_factor);
504 max_coords += enlarge_offset;
505 min_coords -= enlarge_offset;
507 if (MaxSubdivisionLevels > 0) {
511 Vector3 midpoint = (PointLocations[0] + PointLocations[1]) * 0.5f;
512 max_coords2 = midpoint;
513 min_coords2 = midpoint;
514 for (i = 1; i < num_points - 1; i++) {
515 midpoint = (PointLocations[i] + PointLocations[i + 1]) * 0.5f;
523 enlarge_factor += (2 * LineRenderer.Get_Noise_Amplitude());
524 enlarge_offset.
Set(enlarge_factor, enlarge_factor, enlarge_factor);
525 max_coords2 += enlarge_offset;
526 min_coords2 -= enlarge_offset;
550 unsigned int lvl = LineRenderer.Get_Current_Subdivision_Level();
551 lvl =
MIN(lvl, MaxSubdivisionLevels);
552 LineRenderer.Set_Current_Subdivision_Level(lvl);
555 if (MaxSubdivisionLevels > 0) {
566 unsigned int lvl = LineRenderer.Get_Current_Subdivision_Level();
568 lvl =
MIN(lvl+1,MaxSubdivisionLevels);
570 LineRenderer.Set_Current_Subdivision_Level(lvl);
575 int lvl = LineRenderer.Get_Current_Subdivision_Level();
576 if (lvl == 0)
return;
577 LineRenderer.Set_Current_Subdivision_Level(lvl-1);
588 if (LineRenderer.Get_Current_Subdivision_Level() == 0) {
592 float benefit_factor = 1.0f - (0.5f / (polycount * polycount));
593 return (benefit_factor * NormalizedScreenArea) /
Get_Cost();
600 if (LineRenderer.Get_Current_Subdivision_Level() == MaxSubdivisionLevels) {
605 float benefit_factor = 1.0f - (0.5f / (polycount * polycount));
607 return (benefit_factor * NormalizedScreenArea) / polycount;
614 lod =
MIN(lod, (
int)MaxSubdivisionLevels);
616 LineRenderer.Set_Current_Subdivision_Level((
unsigned int)lod);
621 return (
int) LineRenderer.Get_Current_Subdivision_Level();
626 return (
int)MaxSubdivisionLevels;
639 if (PointLocations.Count() < 2)
return;
649 PointLocations.Count(),
650 &(PointLocations[0]),
659 WWASSERT(PointLocations.Count() == PointColors.Count());
660 WWASSERT(PointLocations.Count() == PointWidths.Count());
663 if (PointLocations.Count() < 2)
return;
664 if (PointColors.Count() < 2)
return;
665 if (PointWidths.Count() < 2)
return;
667 if(PointLocations.Count() != PointColors.Count())
return;
668 if(PointLocations.Count() != PointWidths.Count())
return;
681 StreakRenderer.RenderStreak(
684 PointLocations.Count(),
685 &(PointLocations[0]),
703 float fraction = 1.0F;
704 for (
uint32 index = 1; index < (
unsigned int)PointLocations.Count(); index ++)
706#ifdef ALLOW_TEMPORARIES
712 Transform.mulVector3Array(&PointLocations[index-1], curr, 2);
724 float dist = (p0 - p1).Length ();
725 if (dist <= LineRenderer.Get_Width() && fraction >= 0 && fraction < raytest.Result->Fraction) {
WWINLINE void Init(const Vector3 ¢er, const Vector3 &extent)
void Init_Min_Max(const Vector3 &min, const Vector3 &max)
CastResultStruct * Result
RenderObjClass * CollidedRenderObj
bool Find_Intersection(const LineSegClass &other_line, Vector3 *p1, float *fraction1, Vector3 *p2, float *fraction2) const
static void Add_Object(RenderObjClass *robj)
static void Add_Cost(float cost)
virtual float Get_Screen_Size(CameraClass &camera)
virtual int Is_Not_Hidden_At_All(void)
void Invalidate_Cached_Bounding_Volumes(void) const
RenderObjClass & operator=(const RenderObjClass &)
static const float AT_MAX_LOD
virtual int Get_Collision_Type(void) const
static const float AT_MIN_LOD
int Guess_Sort_Level(void) const
virtual void Increment_LOD(void)
virtual void Render(RenderInfoClass &rinfo)
void Set_Opacity(float opacity)
virtual int Get_LOD_Level(void) const
void Set_LocsWidthsColors(unsigned int num_points, Vector3 *locs, float *widths=NULL, Vector4 *colors=NULL, unsigned int *personalities=NULL)
void Set_Merge_Abort_Factor(float factor)
void Render_Streak_Line(RenderInfoClass &rinfo)
SegLineRendererClass::TextureMapMode Get_Texture_Mapping_Mode(void)
StreakLineClass & operator=(const StreakLineClass &that)
void Set_Merge_Intersections(int onoff)
virtual float Get_Cost(void) const
void Set_UV_Offset_Rate(const Vector2 &rate)
void Set_Freeze_Random(int onoff)
int Are_End_Caps_Enabled(void)
void Set_Color(const Vector3 &color)
void Add_Point(const Vector3 &location)
void Set_End_Caps(int onoff)
void Set_Locs(unsigned int num_points, Vector3 *locs)
virtual void Decrement_LOD(void)
float Get_Texture_Tile_Factor(void)
void Set_Disable_Sorting(int onoff)
virtual int Get_Num_Polys(void) const
void Set_Texture(TextureClass *texture)
void Set_Texture_Tile_Factor(float factor)
void Set_Texture_Mapping_Mode(SegLineRendererClass::TextureMapMode mode)
unsigned int Get_Subdivision_Levels(void)
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
virtual float Get_Value(void) const
void Get_Color(Vector3 &color)
int Is_Freeze_Random(void)
int Is_Merge_Intersections(void)
virtual float Get_Post_Increment_Value(void) const
TextureClass * Get_Texture(void)
virtual void Prepare_LOD(CameraClass &camera)
void Set_Width(float width)
void Set_Noise_Amplitude(float amplitude)
float Get_Merge_Abort_Factor(void)
virtual RenderObjClass * Clone(void) const
Vector2 Get_UV_Offset_Rate(void)
virtual void Set_LOD_Level(int lod)
void Set_Point_Location(unsigned int point_idx, const Vector3 &location)
virtual int Get_LOD_Count(void) const
ShaderClass Get_Shader(void)
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
void Set_Subdivision_Levels(unsigned int levels)
void Set_Colors(unsigned int num_points, Vector4 *colors)
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
void Set_Shader(ShaderClass shader)
void Get_Point_Location(unsigned int point_idx, Vector3 &loc)
void Delete_Point(unsigned int point_idx)
int Is_Sorting_Disabled(void)
void Set_Widths(unsigned int num_points, float *widths)
float Get_Noise_Amplitude(void)
void Render_Seg_Line(RenderInfoClass &rinfo)
WWINLINE void Update_Max(const Vector3 &a)
WWINLINE void Update_Min(const Vector3 &a)
WWINLINE float Length(void) const
WWINLINE void Set(float x, float y, float z)
static void Add_To_Static_Sort_List(RenderObjClass *robj, unsigned int sort_level)
static bool Are_Static_Sort_Lists_Enabled(void)
static bool Is_Sorting_Enabled(void)
static WWINLINE float Fabs(float val)
#define MAX_SEGLINE_SUBDIV_LEVELS