59 MaxSubdivisionLevels(0),
60 NormalizedScreenArea(0.0f)
65 MaxSubdivisionLevels(src.MaxSubdivisionLevels),
66 NormalizedScreenArea(src.NormalizedScreenArea),
67 PointLocations(src.PointLocations),
68 LineRenderer(src.LineRenderer)
78 MaxSubdivisionLevels = that.MaxSubdivisionLevels;
79 NormalizedScreenArea = that.NormalizedScreenArea;
80 PointLocations = that.PointLocations;
81 LineRenderer = that.LineRenderer;
93 LineRenderer.Reset_Line();
101 if (num_points < 2 || !locs) {
106 PointLocations.Delete_All();
107 for (
unsigned int i=0; i<num_points; i++) {
108 PointLocations.Add(locs[i],num_points);
118 return PointLocations.Count();
125 if (point_idx < (
unsigned int)PointLocations.Count()) {
126 PointLocations[point_idx] = location;
135 if (point_idx < (
unsigned int)PointLocations.Count()) {
136 loc.
Set(PointLocations[point_idx]);
144 PointLocations.Add(location);
149 if (point_idx < (
unsigned int)PointLocations.Count()) {
150 PointLocations.Delete(point_idx);
157 return LineRenderer.Get_Texture();
162 return LineRenderer.Get_Shader();
167 color.
Set(LineRenderer.Get_Color());
172 return LineRenderer.Get_Opacity();
177 return LineRenderer.Get_Noise_Amplitude();
182 return LineRenderer.Get_Merge_Abort_Factor();
187 return MaxSubdivisionLevels;
192 return LineRenderer.Get_Texture_Mapping_Mode();
197 return LineRenderer.Get_Texture_Tile_Factor();
202 return LineRenderer.Get_UV_Offset_Rate();
207 return LineRenderer.Is_Merge_Intersections();
212 return LineRenderer.Is_Freeze_Random();
217 return LineRenderer.Is_Sorting_Disabled();
222 return LineRenderer.Are_End_Caps_Enabled();
227 LineRenderer.Set_Texture(texture);
232 LineRenderer.Set_Shader(shader);
237 return LineRenderer.Get_Width();
244 LineRenderer.Set_Width(
MAX(width, 0.0f));
251 LineRenderer.Set_Color(color);
256 LineRenderer.Set_Opacity(opacity);
261 LineRenderer.Set_Noise_Amplitude(
WWMath::Fabs(amplitude));
268 LineRenderer.Set_Merge_Abort_Factor(factor);
280 LineRenderer.Set_Texture_Mapping_Mode(mode);
285 LineRenderer.Set_Texture_Tile_Factor(factor);
290 LineRenderer.Set_UV_Offset_Rate(rate);
295 LineRenderer.Set_Merge_Intersections(onoff);
300 LineRenderer.Set_Freeze_Random(onoff);
306 LineRenderer.Set_Disable_Sorting(onoff);
311 LineRenderer.Set_End_Caps(onoff);
325 int subdivision_factor = 1 << LineRenderer.Get_Current_Subdivision_Level();
326 return 2 * (PointLocations.Count() - 1) * subdivision_factor;
364 unsigned int num_points = PointLocations.Count();
368 if (num_points >= 2) {
380 max_coords = PointLocations[0];
381 min_coords = PointLocations[0];
382 for (i = 1; i < num_points; i++) {
387 float enlarge_factor = LineRenderer.Get_Width() * 0.5f;
389 enlarge_offset.
Set(enlarge_factor, enlarge_factor, enlarge_factor);
390 max_coords += enlarge_offset;
391 min_coords -= enlarge_offset;
393 if (MaxSubdivisionLevels > 0) {
397 Vector3 midpoint = (PointLocations[0] + PointLocations[1]) * 0.5f;
398 max_coords2 = midpoint;
399 min_coords2 = midpoint;
400 for (i = 1; i < num_points - 1; i++) {
401 midpoint = (PointLocations[i] + PointLocations[i + 1]) * 0.5f;
409 enlarge_factor += (2 * LineRenderer.Get_Noise_Amplitude());
410 enlarge_offset.
Set(enlarge_factor, enlarge_factor, enlarge_factor);
411 max_coords2 += enlarge_offset;
412 min_coords2 -= enlarge_offset;
436 unsigned int lvl = LineRenderer.Get_Current_Subdivision_Level();
437 lvl =
MIN(lvl, MaxSubdivisionLevels);
438 LineRenderer.Set_Current_Subdivision_Level(lvl);
441 if (MaxSubdivisionLevels > 0) {
452 unsigned int lvl = LineRenderer.Get_Current_Subdivision_Level();
454 lvl =
MIN(lvl+1,MaxSubdivisionLevels);
456 LineRenderer.Set_Current_Subdivision_Level(lvl);
461 int lvl = LineRenderer.Get_Current_Subdivision_Level();
462 if (lvl == 0)
return;
463 LineRenderer.Set_Current_Subdivision_Level(lvl-1);
474 if (LineRenderer.Get_Current_Subdivision_Level() == 0) {
478 float benefit_factor = 1.0f - (0.5f / (polycount * polycount));
479 return (benefit_factor * NormalizedScreenArea) /
Get_Cost();
486 if (LineRenderer.Get_Current_Subdivision_Level() == MaxSubdivisionLevels) {
491 float benefit_factor = 1.0f - (0.5f / (polycount * polycount));
493 return (benefit_factor * NormalizedScreenArea) / polycount;
500 lod =
MIN(lod, (
int)MaxSubdivisionLevels);
502 LineRenderer.Set_Current_Subdivision_Level((
unsigned int)lod);
507 return (
int) LineRenderer.Get_Current_Subdivision_Level();
512 return (
int)MaxSubdivisionLevels;
525 if (PointLocations.Count() < 2)
return;
533 PointLocations.Count(),
534 &(PointLocations[0]),
549 float fraction = 1.0F;
550 for (
uint32 index = 1; index < (
unsigned int)PointLocations.Count(); index ++)
552#ifdef ALLOW_TEMPORARIES
558 Transform.mulVector3Array(&PointLocations[index-1], curr, 2);
570 float dist = (p0 - p1).Length ();
571 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
virtual float Get_Post_Increment_Value(void) const
Vector2 Get_UV_Offset_Rate(void)
int Are_End_Caps_Enabled(void)
void Set_Shader(ShaderClass shader)
virtual int Get_LOD_Level(void) const
unsigned int Get_Subdivision_Levels(void)
TextureClass * Get_Texture(void)
void Set_Freeze_Random(int onoff)
virtual void Render(RenderInfoClass &rinfo)
void Delete_Point(unsigned int point_idx)
virtual float Get_Value(void) const
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
virtual void Prepare_LOD(CameraClass &camera)
void Set_UV_Offset_Rate(const Vector2 &rate)
void Set_Color(const Vector3 &color)
void Set_Texture(TextureClass *texture)
void Set_Noise_Amplitude(float amplitude)
int Is_Freeze_Random(void)
virtual void Increment_LOD(void)
virtual RenderObjClass * Clone(void) const
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
void Set_Texture_Mapping_Mode(SegLineRendererClass::TextureMapMode mode)
void Set_Disable_Sorting(int onoff)
virtual void Set_LOD_Level(int lod)
float Get_Noise_Amplitude(void)
SegLineRendererClass::TextureMapMode Get_Texture_Mapping_Mode(void)
void Get_Color(Vector3 &color)
virtual ~SegmentedLineClass(void)
void Set_Texture_Tile_Factor(float factor)
void Set_Point_Location(unsigned int point_idx, const Vector3 &location)
void Set_Points(unsigned int num_points, Vector3 *locs)
void Get_Point_Location(unsigned int point_idx, Vector3 &loc)
SegmentedLineClass & operator=(const SegmentedLineClass &that)
void Set_Merge_Abort_Factor(float factor)
void Set_Subdivision_Levels(unsigned int levels)
void Render_Seg_Line(RenderInfoClass &rinfo)
virtual int Get_LOD_Count(void) const
void Add_Point(const Vector3 &location)
float Get_Texture_Tile_Factor(void)
ShaderClass Get_Shader(void)
void Set_End_Caps(int onoff)
void Set_Merge_Intersections(int onoff)
virtual float Get_Cost(void) const
float Get_Merge_Abort_Factor(void)
void Set_Opacity(float opacity)
void Set_Width(float width)
int Is_Sorting_Disabled(void)
virtual int Get_Num_Polys(void) const
virtual void Decrement_LOD(void)
int Is_Merge_Intersections(void)
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
int Guess_Sort_Level(void) const
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