com.craftar
Class CraftARContent
- java.lang.Object
-
- com.craftar.CraftARContentBase
-
- com.craftar.CraftARContent
-
- Direct Known Subclasses:
- CraftARContent3dmodel, CraftARContentImage, CraftARContentImageButton, CraftARContentVideo
public abstract class CraftARContent extends CraftARContentBase
Abstract class for a content that can be drawn on top of a reference image for a CraftARItemAR. Contents can be parsed from a JSON scene description obtained with the CraftARCloudRecognition module, or created from local resources.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description class
CraftARContent.ContentStatus
class
CraftARContent.ContentTouchEvent
Event ids for user's interaction with contents Native values can be found in contentRenderer.h TOUCH_UP = 0, TOUCH_DOWN = 1, TOUCH_IN = 2, TOUCH_OUT = 3class
CraftARContent.ContentWrapMode
The wrap mode defines how flat contents are scaled in relation with the reference image.protected class
CraftARContent.LoadContentInBackground
-
Nested classes/interfaces inherited from class com.craftar.CraftARContentBase
CraftARContentBase.ContentType, CraftARContentBase.ContentTypeName
-
-
Field Summary
Fields Modifier and Type Field and Description protected boolean
isAppInBg
protected float
mAlpha
protected CraftARTouchEventInterface.OnContentClickListener
mClickListener
protected int
mContentID
java.lang.String
mHyperlinkUrl
java.lang.String
mId
protected long
mNativeContentPtr
protected float[]
mRotationMatrix
protected float[]
mScale
protected int
mStatus
protected CraftARTouchEventInterface.OnTouchEventListener
mTouchEventListener
protected float[]
mTranslation
int
mType
protected java.lang.String
mUUID
protected int
mWrapMode
-
Constructor Summary
Constructors Constructor and Description CraftARContent()
Content Creation methodsCraftARContent(JSONObject object)
Creates a CraftARTrackingContent from a a single specific content from the 'contents' field of the JSON API response from the cloud.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description protected void
cancelContentLoad()
protected abstract void
contentLoadFinalized(boolean success)
protected abstract void
drawWithItemPose(float[] translation, float[] rotation, int drawMode)
Content Drawing interfaceprotected void
finalize()
float
getAlpha()
Get this content's alpha transparencyint
getContentType()
Returns the type of this content (image,video,button, etc) .float[]
getRotationMatrix()
Get the rotation matrix of this contentfloat[]
getScale()
Get the scale if this contentprotected int
getStatus()
float[]
getTranslation()
Get the translation vector of this content relative to the reference's centerjava.lang.String
getUUID()
Get this content's UUIDint
getWrapMode()
Get the wrap mode of this contentvoid
onAppFinish()
void
onAppPause()
void
onAppResume()
void
onDestroyedForOrientationChange()
void
setAlpha(float alpha)
Set the alpha transparency to draw this content withvoid
setContentClickListener(CraftARTouchEventInterface.OnContentClickListener contentClickListener)
Sets the @CraftARTouchEventInterface.OnContentClickListener that will handle the click events for this @CraftARTrackingContent.void
setContentTouchEventListener(CraftARTouchEventInterface.OnTouchEventListener contentTouchEventListener)
Sets the @CraftARTouchEventInterface.OnContentTouchListener that will handle the touch events for this @CraftARTrackingContent.void
setContentVersion(int contentsVersion)
void
setRotationMatrix(float[] rotationMatrix)
Set the rotation matrix of this contentvoid
setScale(float[] scale)
Set the scale of this contentvoid
setTranslation(float[] translation)
Set the translation vector for this content relative to the reference's center.void
setWrapMode(int wrapMode)
Set the wrap mode for this contentvoid
update()
Internal updateprotected abstract void
updateContentAttributes()
-
Methods inherited from class com.craftar.CraftARContentBase
clearContentResources, contentTypeFromJSON, trackingLost, trackingStarted
-
-
-
-
Field Detail
-
mNativeContentPtr
protected long mNativeContentPtr
-
mId
public java.lang.String mId
-
mType
public int mType
-
mHyperlinkUrl
public java.lang.String mHyperlinkUrl
-
mTranslation
protected float[] mTranslation
-
mRotationMatrix
protected float[] mRotationMatrix
-
mScale
protected float[] mScale
-
mWrapMode
protected int mWrapMode
-
mAlpha
protected float mAlpha
-
mUUID
protected java.lang.String mUUID
-
mStatus
protected int mStatus
-
isAppInBg
protected boolean isAppInBg
-
mContentID
protected int mContentID
-
mTouchEventListener
protected CraftARTouchEventInterface.OnTouchEventListener mTouchEventListener
-
mClickListener
protected CraftARTouchEventInterface.OnContentClickListener mClickListener
-
-
Constructor Detail
-
CraftARContent
public CraftARContent()
Content Creation methods
-
CraftARContent
public CraftARContent(JSONObject object) throws CraftARSDKException
Creates a CraftARTrackingContent from a a single specific content from the 'contents' field of the JSON API response from the cloud.- Throws:
CraftARSDKException
-
-
Method Detail
-
getContentType
public int getContentType()
Returns the type of this content (image,video,button, etc) . Returned value can be compared to CraftARTrackingContent.ContentType
-
setTranslation
public void setTranslation(float[] translation)
Set the translation vector for this content relative to the reference's center.- Parameters:
translation
- array of 3 floats for x, y, z components.
-
getTranslation
public float[] getTranslation()
Get the translation vector of this content relative to the reference's center- Returns:
- translation array of 3 floats for x, y, z components.
-
setRotationMatrix
public void setRotationMatrix(float[] rotationMatrix)
Set the rotation matrix of this content- Parameters:
rotationMatrix
- 4x4 homogeneous matrix
-
getRotationMatrix
public float[] getRotationMatrix()
Get the rotation matrix of this content- Returns:
- 4x4 homogeneous matrix
-
setScale
public void setScale(float[] scale)
Set the scale of this content- Parameters:
scale
- array of 3 floats with the scale for the x, y, z axis
-
getScale
public float[] getScale()
Get the scale if this content- Returns:
- array of 3 floats with the scale for the x, y, z axis
-
setWrapMode
public void setWrapMode(int wrapMode)
Set the wrap mode for this content- Parameters:
wrapMode
-- See Also:
- CraftARContent.ContentWrapMode
-
getWrapMode
public int getWrapMode()
Get the wrap mode of this content- See Also:
- CraftARContent.ContentWrapMode
-
setAlpha
public void setAlpha(float alpha)
Set the alpha transparency to draw this content with- Parameters:
alpha
- value
-
getAlpha
public float getAlpha()
Get this content's alpha transparency- Returns:
-
getUUID
public java.lang.String getUUID()
Get this content's UUID- Returns:
-
updateContentAttributes
protected abstract void updateContentAttributes()
-
contentLoadFinalized
protected abstract void contentLoadFinalized(boolean success)
-
getStatus
protected int getStatus()
-
finalize
protected void finalize()
- Overrides:
finalize
in classjava.lang.Object
-
cancelContentLoad
protected void cancelContentLoad()
-
drawWithItemPose
protected abstract void drawWithItemPose(float[] translation, float[] rotation, int drawMode)
Content Drawing interface
-
update
public void update()
Internal update
-
setContentClickListener
public void setContentClickListener(CraftARTouchEventInterface.OnContentClickListener contentClickListener)
Sets the @CraftARTouchEventInterface.OnContentClickListener that will handle the click events for this @CraftARTrackingContent.
-
setContentTouchEventListener
public void setContentTouchEventListener(CraftARTouchEventInterface.OnTouchEventListener contentTouchEventListener)
Sets the @CraftARTouchEventInterface.OnContentTouchListener that will handle the touch events for this @CraftARTrackingContent.
-
setContentVersion
public void setContentVersion(int contentsVersion)
- Overrides:
setContentVersion
in classCraftARContentBase
-
onAppResume
public void onAppResume()
-
onAppPause
public void onAppPause()
-
onAppFinish
public void onAppFinish()
-
onDestroyedForOrientationChange
public void onDestroyedForOrientationChange()
-
-