-
Notifications
You must be signed in to change notification settings - Fork 68
Added Turntable animation exporter #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,9 +86,28 @@ public final int getWidth() { | |
| return container.getWidth(); | ||
| } | ||
| // get the image rendered in container in high quality | ||
| public BufferedImage getImage() { | ||
| public BufferedImage getImage() throws Exception { | ||
| return container.getImage(); | ||
| } | ||
|
|
||
| // get camera position | ||
| public final float[] getCamPosition() { return this.camera.getCamPosition(); } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't write these as one line, write as
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's a single line of code, i tends to write such methods like that (Another bad Habit) will change.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I don't like long lines very much. There is a reason swift > objective-c :) |
||
|
|
||
| public BufferedImage getImage(final Color bgColor, final boolean addWatermark) throws Exception { return container.getImage(bgColor, addWatermark); } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do the variables need to be final? I think you can remove the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just an agreement that i will never modify it, will change it if you don't like it
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think final should only be used when there is a reason for it. That's how I'm usually handling it.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will change, but i will also love to know what your reasons are
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly "Shorter is better and faster to read".
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The answer here is pretty good: http://stackoverflow.com/questions/154314/when-should-one-use-final-for-method-parameters-and-local-variables |
||
| public BufferedImage getImage(SimpleVector camPos, final Color bgColor, final boolean addWatermark) throws Exception { return this.getImage(camPos, bgColor, addWatermark, false); } | ||
| public BufferedImage getImage(SimpleVector camPos, final Color bgColor, final boolean addWatermark, final boolean camLookAtOrigin) throws Exception { | ||
| // get camera's initial position | ||
| float[] initialCamPos = this.getCamPosition(); | ||
| // set camera position for the "shot" | ||
| this.camera.setPosition(camPos.x, camPos.y, camPos.z); | ||
| // camera look at origin | ||
| if (camLookAtOrigin) this.camera.lookAt(new SimpleVector()); | ||
|
|
||
| BufferedImage image = getImage(bgColor, addWatermark); | ||
| // reset camera to it initial position | ||
| this.camera.setView(new SimpleVector(initialCamPos)); | ||
| return image; | ||
| } | ||
| // get the depth image | ||
| public BufferedImage getDepthImage() { | ||
| return container.getDepthImage(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exception does this throw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IOException while loading the font for the watermark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the Exception that is thrown explicit then? I.e. IOException instead of Exception?