Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linear path code questions

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Development
View previous topic :: View next topic  
Author Message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Wed Jan 27, 2010 10:11 pm    Post subject: Linear path code questions Reply with quote

Hi all,
I have added linear (straight line) paths (just an unclosed polygon for now) to my local DeleD codebase (also works with load/save).

Currently, there are no create properties associated with the new TPath primitive, but there might be in the future...

I have also tweaked the lath command so it works with TPath too.

Both sorts of smoothing crashes ATM with paths as it isn't closed.

If I fix up the smoothing so it totally ignores the TPath primitive type and doesn't crash any more, should I then check in my new primitive code into subversion so others can use it?

Or should I wait till possibly more things can be done with it?

Already, people could use paths for, let say, gun ports or something on a model and read them in from the scene file.

NOTES:

The path(s) renders just fine for the 3 x 2d view modes, but in 3d mode they still render as closed polygons.

I can't figure out how I would draw this primitive type as just lines in 3d mode because of the RenderQueue class dishing out polygons that get drawn (NOT TPrimitive descendents)..

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Thu Jan 28, 2010 4:11 am    Post subject: Reply with quote

Hi Jeroen and PJ,
I have now fixed up the code so both types of smoothing (Catmull-Clark and Doo-Sabin) completely ignore any selected TPath primitives, and only work on other polygon-based primitives as usual.

Should I now check-in my changes, or perhaps submit a patch?

I have done quite a few changes to the code...but I haven't noticed any crashes, or other issues yet.

Here is a summary of the changes:

1. there is now a TPath primitive type (just an open polygon primitive) (includes a graphic in the create/edit GUI options).
2. scenes with TPath primitives can be loaded/saved.
3. The lath command works on TPath.
4. The 2 smoothing commands (Catmull-Clark and Doo-Sabin) ignore this type of primiive ATM instead of just crashing...ie. no change happens to the scene for TPath primitives using these.

cheers,
paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Thu Jan 28, 2010 7:32 pm    Post subject: Reply with quote

Paul... awesome! I say just commit it!

The worst that can happen is that unexpected things turn up (bugs/instability), which we can then fix or temporary revert. If that's the case and it bothers us, we can always decide then and there to fall back onto patch-review-commit cycles in the future... for now, I much prefer moving forward as fast as possible! Smile
Back to top
View user's profile Send private message Visit poster's website
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Thu Jan 28, 2010 7:46 pm    Post subject: Reply with quote

Alrighty then!

I will commit it very soon Smile

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Thu Jan 28, 2010 9:52 pm    Post subject: Reply with quote

Now committed Smile

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Fri Jan 29, 2010 10:07 am    Post subject: Reply with quote

Yay! I have added it to the changelog... we just need some documentation and a cool screenshot, but we could focus on that during testing week (February 8-15). Perhaps we can get some creative user do do it.

Oh, I also have a bug report: I don't think it works in the front view. Perhaps I'm clicking wrong, but if you could check that out that would be sweet.
Back to top
View user's profile Send private message Visit poster's website
chronozphere
DeleD PRO user


Joined: 20 Jun 2006
Posts: 1010
Location: Netherlands

PostPosted: Fri Jan 29, 2010 10:19 am    Post subject: Reply with quote

I can confirm that bug. You can't make paths in the front view. Also, after an attempt, you can't make other primitives there too:

> Select path and click a few times in front view (nothing happens)
> Select cube and try to make a cube in the front view.

I also think we need another way of rendering path's. DeleD is now attempting to make weird looking polygons out of them. Laughing

Great work paul, keep it up!
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Fri Jan 29, 2010 6:14 pm    Post subject: Reply with quote

chronozphere wrote:
I can confirm that bug. You can't make paths in the front view. Also, after an attempt, you can't make other primitives there too:

> Select path and click a few times in front view (nothing happens)
> Select cube and try to make a cube in the front view.

I also think we need another way of rendering path's. DeleD is now attempting to make weird looking polygons out of them. Laughing

Great work paul, keep it up!


Bug is fixed and committed - forgot to change 2 variables after copy + paste...D'OH!

working on drawing paths in 3d correctly as lines only...

EDIT: I believe I have a patch for the 3d path drawing code, but now I have to modify the patch code for my new version of the code first.

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Fri Jan 29, 2010 8:42 pm    Post subject: Reply with quote

Hi again,
I have now committed a patch to make paths draw as lines in 3d mode now, and not those horrible filled polygons Wink

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Wed Feb 03, 2010 2:34 am    Post subject: Reply with quote

I have another linear path question for you...

I have noticed that in my current path implementation, you can only do paths of 3 or more vertices, ie. no single edge/line paths.

This is so you can select the path by clicking on it (not selection rects), and it uses the triangle formed by the vertices as a collision test.

Should I alter the paths so you can use 2 or more vertices instead of 3 or more?

If so, then I would have to put in another test for this type of path with only 2 vertices, like checking for clicks within some distance to the line between the 2 vertices when doing selection via click only...

I already have code that can do point vs line tests which I can use, but I thought I'd ask first on your opinions Smile

Paths with only 1 edge would be useful too I guess Wink

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
chronozphere
DeleD PRO user


Joined: 20 Jun 2006
Posts: 1010
Location: Netherlands

PostPosted: Wed Feb 03, 2010 8:56 am    Post subject: Reply with quote

I think one edge paths should be supported. Smile

I saw that you implemented the path by using the TPolygon class. No offense, but "A polygon is NOT a path" Smile . My advice would be to create a new TPath class for this. You can make this new class work as you want and you could copy code from the polygon class as you see fit.

Making the TPolygon class work as a single-edge path violates the purpose of that class. Each genuine "polygon" should always have 3 vertices. If you are going to add exceptions to that rule, you may end up with confusing and buggy code.

It may be a lot harder to make a new class, but I'm sure it pays off in the end.

Just my $0.02 Wink

Good luck! Very Happy
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Wed Feb 03, 2010 9:23 am    Post subject: Reply with quote

chronozphere wrote:
I think one edge paths should be supported. Smile

I saw that you implemented the path by using the TPolygon class. No offense, but "A polygon is NOT a path" Smile . My advice would be to create a new TPath class for this. You can make this new class work as you want and you could copy code from the polygon class as you see fit.

Making the TPolygon class work as a single-edge path violates the purpose of that class. Each genuine "polygon" should always have 3 vertices. If you are going to add exceptions to that rule, you may end up with confusing and buggy code.

It may be a lot harder to make a new class, but I'm sure it pays off in the end.

Just my $0.02 Wink

Good luck! Very Happy


Thanks for the $0.02 Smile

I really value your opinion.

I agree that I should create create a TPath class instead of using a TPolygon, but I wasn't sure how to do this currently.

I will take another look at the code.

thanks dude Smile

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
chronozphere
DeleD PRO user


Joined: 20 Jun 2006
Posts: 1010
Location: Netherlands

PostPosted: Wed Feb 03, 2010 10:29 am    Post subject: Reply with quote

Great! Smile

This is the reason why I think DeleD must be refactored. Adding a Path type is quite difficult because there are no abstract classes we can use to derive from. Moreover, functionality like "Polygons" are scattered over a lot of files (look at all the selection-lists etc).

I would like to help to refactor this. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum