Package camera3D.generators
Class Generator
java.lang.Object
camera3D.generators.Generator
- Direct Known Subclasses:
ChromaDepthGenerator
,DepthMapGenerator
,Monoscopic360Generator
,RegularRenderer
,SplitDepthGenerator
,StereoscopicGenerator
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
Functional Interface for Passing Pixel Copy Instructions. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
cleanup
(processing.core.PApplet parent) This is called after the last call to the user's draw method and before the user's postDraw method.protected float
clip
(float x) Simple utility function that is used in a couple of places.protected float
clip
(float x, float min, float max) Simple utility function that is used in a couple of places.abstract void
completedDraw
(int frameNum, processing.core.PApplet parent) This is called once after each call to the user's draw method.boolean
copyFrameNumber
(int frameNum) Communicate to Camera3D instance if frame pixels should be copied to pixelStorage.protected void
executeTask
(int length, Generator.PixelCopyTask task) Divide up pixels and execute groups in parallelabstract void
generateCompositeFrame
(int[] pixelDest, int[][] pixelStorage) Combine the component frames into one composite frame.void
generateCompositeFrameAndSaveComponents
(int[] pixelDest, int[][] pixelStorage, processing.core.PApplet parent, String parentClassName, String saveFrameLocation) Call generateCompositeFrame several times with pixelStorage setup as empty (black) images for all but one of the pixel arrays.abstract int
The number of components in the composite image, ie, the number of times to call the draw method.abstract String
getComponentFrameName
(int frameNum) Give each component a name, such as "left" and "right" for anaglyph images.protected void
initExecutor
(int threadCount) Initialize Parallel Executor for pixel copying.insertFrame
(String what, int frameCount) Copied from PAppletvoid
Notify renderer that something about the camera changed.abstract void
prepareForDraw
(int frameNum, processing.core.PApplet parent) This is called once before each call to the user's draw method.protected abstract void
Perform renderer recalculations due to camera config change.
-
Field Details
-
config
-
-
Method Details
-
getComponentCount
public abstract int getComponentCount()The number of components in the composite image, ie, the number of times to call the draw method.- Returns:
- int
-
getComponentFrameName
Give each component a name, such as "left" and "right" for anaglyph images.- Parameters:
frameNum
-- Returns:
-
copyFrameNumber
public boolean copyFrameNumber(int frameNum) Communicate to Camera3D instance if frame pixels should be copied to pixelStorage. This will almost always be true but some Generators can improve performance by skipping the loadPixels() call and the System.arraycopy()- Parameters:
frameNum
-- Returns:
-
notifyCameraConfigChange
Notify renderer that something about the camera changed. For example, the stereoscopic generators need to do some recalculations when the camera moves.- Parameters:
config
-
-
recalculateCameraSettings
protected abstract void recalculateCameraSettings()Perform renderer recalculations due to camera config change. -
prepareForDraw
public abstract void prepareForDraw(int frameNum, processing.core.PApplet parent) This is called once before each call to the user's draw method. Typically the generators need to move the camera around or change some settings.- Parameters:
frameNum
-parent
-
-
generateCompositeFrame
public abstract void generateCompositeFrame(int[] pixelDest, int[][] pixelStorage) Combine the component frames into one composite frame.- Parameters:
pixels
-pixelsAlt
-
-
generateCompositeFrameAndSaveComponents
public void generateCompositeFrameAndSaveComponents(int[] pixelDest, int[][] pixelStorage, processing.core.PApplet parent, String parentClassName, String saveFrameLocation) Call generateCompositeFrame several times with pixelStorage setup as empty (black) images for all but one of the pixel arrays. This lets us see how the generator is modifying each of the components. This is super helpful for debugging a new generator. For most generators this will work as intended. If for some reason it does not work for your custom generator, override this method and write something that works correctly.- Parameters:
pixelDest
-pixelStorage
-parent
-parentClassName
-saveFrameLocation
-
-
completedDraw
public abstract void completedDraw(int frameNum, processing.core.PApplet parent) This is called once after each call to the user's draw method. Typically this is not needed.- Parameters:
frameNum
-parent
-
-
cleanup
public abstract void cleanup(processing.core.PApplet parent) This is called after the last call to the user's draw method and before the user's postDraw method. This should put the camera back so other libraries like ControlP5 can function correctly.- Parameters:
parent
-
-
initExecutor
protected void initExecutor(int threadCount) Initialize Parallel Executor for pixel copying.- Parameters:
threadCount
-
-
executeTask
Divide up pixels and execute groups in parallel- Parameters:
length
-task
-
-
clip
protected float clip(float x) Simple utility function that is used in a couple of places.- Parameters:
x
-- Returns:
-
clip
protected float clip(float x, float min, float max) Simple utility function that is used in a couple of places.- Parameters:
x
-min
-max
-- Returns:
-
insertFrame
Copied from PApplet- Parameters:
what
-frameCount
-- Returns:
-