> I'm having trouble understanding the control flow and data structures in
> Jmol.

It is not easy.

> I've got g3d working, and I've ported most of org.jmol.viewer,
> andorg.jmol.api, but I'm not entirely sure what to *do* with them.

OK.

> I want to be able to draw a molecule -- just a simple alkene or alcohol,
> nothing crazy. I can't figure out *where* to do that though.

Before you draw the molecule, you need to be able to read it.

You should next port the org.jmol.adapter.smarter package.

Write a small test program that instantiates a SmarterAdapter. Then read
in a file using it.

You do not need to store the contents anyplace, but you need to iterate
through all the atoms and all the bonds.

> Control flow:
> I'm rather confused by the  rendering pipeline -- Graphics3D, Viewer,
> FrameRenderer, Frame, Platform3D -- so many related classes,

Graphics3D and Platform3D provide rendering primitives. You have
demonstrated that part working, so don't worry about them anny more.

> and it
> seems like some of them run threads in the background then notify others
> when they're done. I just want a simplified pipeline: on repaint, draw
> model to image, copy image to screen. In trying to figure this out, I've
> come up with these questions:
>
> What is Frame?

The name 'Frame' is poorly chosen and is there for historical reasons.

It holds all of data model.

Viewer -> ModelManager -> Frame -> various shapes that have visual
representations.

> How does it relate to FrameRenderer?
> Why does a FrameRenderer need a Frame?

The FrameRenderer's job is to render the Frame. It does this by delegating
to BallsRenderer, SticksRenderer, RibbonsRenderer, etc.

> What is the relationship between Platform3D, Graphics3D, and Viewer?

I would say ... almost none.

> They seem to have a lot of interconnections and delegate a lot of things
> to eachother.

The Viewer delegates everything to instances of other classes.

The viewer tells the g3d to start the paint cycle and to end the paint cycle.

In between, the FrameRenderer effectively makes a bunch of calls to g3d to
draw spheres, cylinders, lines, etc.

> Data structures:
> I want to be able to say something like myJmol.AddAtom(new Carbon(x, y,
> z))
> or myJmol.addBond(thisCarbon, thatCarbon, BondType.SINGLE_BOND)
> In other words, I'm constructing my model programmatically at run time,
> not from a filie.

Not possible.

If you do not want to do it from a file you do not have to. But you must
go through an implementation of the JmolAdapter interface.

> It looked to me like the way to do that would be to make an
> implementation of JmolAdapter , and make it iterate over my data
> structure with an AtomIterator. Then I'd give an instance MyAdapater to
> the instance of org.jmol.viewer.Viewer. Is that the right general idea?

Correct.

> Or should I get the SmarterAdapter working first?

I think that you should get the SmarterAdapter working first.

> Help? I need to make some progress with this soon or it's back to
> Direct3D for me :(

The issues that you are struggling with now have nothing to do with Direct3D.

You need a data model to hold data structures that represent the atoms of
your molecule.

If you want, you could write your own ... directly on top of org.jmol.g3d

Or, you can continue trying to translate to C#.


Miguel



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to