Subject:
|
Re: Animation - LDraw Object Classes - help needed!
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Wed, 5 Sep 2001 07:54:22 GMT
|
Viewed:
|
731 times
|
| |
| |
Gary Williams wrote:
>
> Interesting. Eventually I want to include an animation scripting feature in
> the CAD program I'm developing (which happens to be written in Delphi).
> Perhaps we can collaborate to some extent.
Cool! I'd love to.
>
>
> > Just like TObject is the ancestor of all Delphi classes, I suggest a class called LDObject.
> >
> > Now, how and where do we declare it?
> > LDObject1 = class (LDObject) // or something like that?
> > // Could be a Part, a Primitive (not likely though), or a [Sub-]Model.
>
> There's no need to define the scripting language as being _exclusively_ for
> Lego models. I'd suggest naming this class "Entity" or something similar
> instead to make it generic and applicable to anything. For example, in the
> CAD program I'm developing, I have a generic TEntity object that happens to
> represent a Lego model, sub-model, part, sub-part, primitive, etc. but it's
> all abstracted so it could just as easily be a piece of furniture you're
> dragging through a floorplan of a house. The higher-level code has no idea
> what the user is manipulating, they just happen to be LDraw objects.
I see your point. It seems like LDObject won't be the highest ancestor class anyway.
I plan to define LDraw Camera and POV camera differently (but I might change my mind)
Is it possible to let a compiled and distributed program import new classes with new
procedures written in Delphi text code? Probably not...
I mean, something like this:
-- distributed zip file -----
| LDA2001.exe |
| |
| LDAObjects.def |
| |
-----------------------------
OfficialUpdate01.def
UsersOwn.def
My vision is that any user will be able to write his own procedures without having
to recompile the .exe file.
As I don't think it's possible, I work on eveloping a script language and a system
for defining classes, procedures, and functions for LDA2001.
And, as usual, I pick a little here and a little there; some BASIC, some C, some
Pascal, and some homebrew.
>
> According to Webster, entity = n. something existing complete in itself, by
> its own right
>
> Just a suggestion.
I'll think about it.
>
>
> > The LDObject class has these properties predefined:
> > Name: String; // In this case: 'LDObject1', user may change it
> > Index: Integer; // 0-999, assigned by program, user cannot change.
> Sort of a pointer
>
> Why not 0..MaxInt instead of limiting it to 1,000 objects?
Because of file naming issues. But I've thought of 0..0xFFF.
See http://home.swipnet.se/simlego/ldraw/lda2001.htm
>
>
> > Color: Longint; //
>
> I suggest you rename this to ColorCode so it doesn't get confused with an
> actual RGB value.
Before the first working and useful version is launched, I'll decide if I take your advise.
>
>
> > We also need some movement and rotation properties.
> > With rotation, I don't mean like the static 0 ROTATE command, but rather
> the spinning movement.
>
> You might be able to use a standard matrix to represent the rotation of an
> object between consecutive animation frames, then the animating program
> could apply this rotation matrix over and over again.
Great idea! I thought if something more complicated.
>
> Will objects be forced to rotate around their insertion points (local
> origins), or can we define centers of mass (the point an object would rotate
> around if spun in the absense of external gravitational influence)?
I think that the way I plan to do it, you'll be able to alter the rotation point.
I'm not sure though. Time will tell.
>
> For that matter, I wish there was a database somewhere that contained the
> approximate mass of every Lego part that exists in LDraw format. Then my
> CAD program could determine the total mass and approximate center of mass
> for a given model.
That's way beyond my project.
>
> (I apologize for rambling!)
Keep ramblin'!
>
> -Gary
Here's some more examples on how the files may look like.
Notice that I've already changed the syntax from the LDA2001 page.
Also remeber that the program will write 95% of all the script code for you.
Syntax will be subject for more changes.
- - - MyAn.txt - - -
LDraw Animation Script File
include lda2001.def
var nObjects = 0
Create Scene as LDObject
Scene.File$ = 'Scene01.dat'
Create Camera1 as POVCamera
Camera1.Position 200 -80 -250
Camera1.Lookat 0 -100 0
Camera1.Shoot
- - - lda2001.def - - -
// Main class definition file
class LDObject
var Name$ = %1
var Index ! nObjects
var Color = 16
var x = 0
var y = 0
var z = 0
var a = 1
var b = 0
var c = 0
var d = 0
var e = 1
var f = 0
var g = 0
var h = 0
var i = 1
var File$
var MovX = 0
var MovY = 0
var MovZ = 0
var RotA = 1
var RotB = 0
var RotC = 0
var RotD = 0
var RotE = 1
var RotF = 0
var RotG = 0
var RotH = 0
var RotI = 1
procedure OnCreate
begin
nObjects.Inc
end
procedure Position
begin
self.x = %1
self.y = %2
self.z = %3
end
procedure Move
begin
self.x = self.x + %1
self.y = self.y + %2
self.z = self.z + %3
end
procedure Movement
begin
self.x = self.MovX + %1
self.y = self.MovY + %2
self.z = self.MovZ + %3
end
end class
|
|
Message is in Reply To:
| | Re: Animation - LDraw Object Classes - help needed!
|
| (...) creating the framework for LDraw Object Classes (...) other, easier, more flexible, better suited or (...) Interesting. Eventually I want to include an animation scripting feature in the CAD program I'm developing (which happens to be written (...) (23 years ago, 3-Sep-01, to lugnet.cad.dev)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|