Added light & camera data structures to jAssimp and updated the list of configuration properties. However, I still had not yet the time to write the C++ binding to the Java API.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@183 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2008-10-18 19:52:23 +00:00
parent f2c9745b7d
commit 38004d789c
4 changed files with 603 additions and 41 deletions

View File

@ -1,11 +1,182 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2008, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
package assimp;
/**
* Created by IntelliJ IDEA.
* User: Alex
* Date: 09.10.2008
* Time: 13:54:10
* To change this template use File | Settings | File Templates.
/** Describes a virtual camera in the scene
*
* Cameras have a representation in the node graph and can be animated
*
* @author Aramis (Alexander Gessler)
* @version 1.0
*/
public class Camera {
}
public class Camera
{
/** The name of the camera.
*/
private String mName;
/** Position of the camera
*/
private float[] mPosition;
/** 'Up' - vector of the camera coordinate system
*/
private float[] mUp;
/** 'LookAt' - vector of the camera coordinate system relative to
*/
private float[] mLookAt;
/** Half horizontal field of view angle, in radians.
*/
private float mHorizontalFOV;
/** Distance of the near clipping plane from the camera.
*/
private float mClipPlaneNear;
/** Distance of the far clipping plane from the camera.
*/
private float mClipPlaneFar;
/** Screen aspect ratio.
*/
private float mAspect;
/** Get the screen aspect ratio of the camera
*
* This is the ration between the width and the height of the
* screen. Typical values are 4/3, 1/2 or 1/1. This value is
* 0 if the aspect ratio is not defined in the source file.
* 0 is also the default value.
*/
public final float GetAspect()
{
return mAspect;
}
/** Get the distance of the far clipping plane from the camera.
*
* The far clipping plane must, of course, be farer away than the
* near clipping plane. The default value is 1000.f. The radio
* between the near and the far plane should not be too
* large (between 1000-10000 should be ok) to avoid floating-point
* inaccuracies which could lead to z-fighting.
*/
public final float GetFarClipPlane()
{
return mClipPlaneFar;
}
/** Get the distance of the near clipping plane from the camera.
*
* The value may not be 0.f (for arithmetic reasons to prevent
* a division through zero). The default value is 0.1f.
*/
public final float GetNearClipPlane()
{
return mClipPlaneNear;
}
/** Half horizontal field of view angle, in radians.
*
* The field of view angle is the angle between the center
* line of the screen and the left or right border.
* The default value is 1/4PI.
*/
public final float GetHorizontalFOV()
{
return mHorizontalFOV;
}
/** Returns the 'LookAt' - vector of the camera coordinate system
* relative to the coordinate space defined by the corresponding node.
*
* This is the viewing direction of the user.
* The default value is 0|0|1. The vector may be normalized, but it
* needn't.
* @return component order: x,y,z
*/
public final float[] GetLookAt()
{
return mLookAt;
}
/** Get the 'Up' - vector of the camera coordinate system relative
* to the coordinate space defined by the corresponding node.
*
* The 'right' vector of the camera coordinate system is
* the cross product of the up and lookAt vectors.
* The default value is 0|1|0. The vector
* may be normalized, but it needn't.
* @return component order: x,y,z
*/
public final float[] GetUp()
{
return mUp;
}
/** Get the position of the camera relative to the coordinate space
* defined by the corresponding node.
*
* The default value is 0|0|0.
* @return component order: x,y,z
*/
public final float[] GetPosition()
{
return mPosition;
}
/** Returns the name of the camera.
*
* There must be a node in the scenegraph with the same name.
* This node specifies the position of the camera in the scene
* hierarchy and can be animated.
*/
public final String GetName()
{
return mName;
}
};

View File

@ -0,0 +1,125 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2008, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
package assimp;
// ---------------------------------------------------------------------------
/** Enumerates components of the <code>Scene</code> and <code>Mesh</code>
* classes that can be excluded from the import with the RemoveComponent step.
*
* See the documentation for the postprocessing step for more details.
* @author Aramis (Alexander Gessler)
* @version 1.0
*/
public class Component
{
/** Normal vectors are removed from all meshes
*/
public static final int NORMALS = 0x2;
/** Tangents an bitangents are removed from all meshes
*
* Tangents and bitangents below together in every case.
*/
public static final int TANGENTS_AND_BITANGENTS = 0x4;
/** All vertex color sets are removed
*
* Use <code>COLORn(N)</code> to specifiy the N'th set
*/
public static final int COLORS = 0x8;
/** All texture UV sets are removed
*
* Use <code>TEXCOORDn(N)</code> to specifiy the N'th set
*/
public static final int TEXCOORDS = 0x10;
/** Removes all bone weights from all meshes.
*
* The scenegraph nodes corresponding to the
* bones are removed
*/
public static final int BONEWEIGHTS = 0x20;
/** Removes all bone animations
*/
public static final int ANIMATIONS = 0x40;
/** Removes all embedded textures
*/
public static final int TEXTURES = 0x80;
/** Removes all light sources
*
* The scenegraph nodes corresponding to the
* light sources are removed.
*/
public static final int LIGHTS = 0x100;
/** Removes all light sources
*
* The scenegraph nodes corresponding to the
* cameras are removed.
*/
public static final int CAMERAS = 0x200;
/** Removes all meshes (aiScene::mMeshes).
*/
public static final int MESHES = 0x400;
/** Removes all materials. One default material will
* be generated, so aiScene::mNumMaterials will be 1.
* This makes no real sense without the <code>TEXTURES</code> flag.
* */
public static final int MATERIALS = 0x800;
public static final int COLORSn(int n)
{
return (1 << (n + 20));
}
public static final int TEXCOORDSn(int n)
{
return (1 << (n + 25));
}
};

View File

@ -39,9 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
package assimp;
/**
* Defines configuration properties.
* <p/>
@ -175,29 +175,30 @@ public class ConfigProperty {
public static final String AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE
= "pp.gsn.max_smoothing";
/**
* Specifies the minimum number of faces a node should have.
* This is an input parameter to the OptimizeGraph-Step.
* <p/>
* Nodes whose referenced meshes have less faces than this value
* are propably joined with neighbors with identical world matrices.
* However, it is just a hint to the step.
* The type of the property is int.
*/
public static final String AI_CONFIG_PP_OG_MIN_NUM_FACES
= "pp.og.min_faces";
/** Input parameter to the #aiProcess_RemoveComponent step:
* Specifies the parts of the data structure to be removed.
*
* See the documentation to this step for further details. The property
* is expected to be an integer, a bitwise combination of the
* flags defined in the <code>Component</code> class. The default
* value is 0. Important: if no valid mesh is remaining after the
* step has been executed (e.g you thought it was funny to specify ALL
* of the flags defined above) the import FAILS. Mainly because there is
* no data to work on anymore ...
*/
public static final String AI_CONFIG_PP_RVC_FLAGS
= "pp.rvc.flags";
/** \brief Specifies whether animations are removed from the asset.
* This is an input parameter to the OptimizeGraph-Step.
*
* If an application does not need the animation data, erasing it at the
* beginning of the post-process pipeline allows some steps - including
* OptimizeGraph itself - to apply further optimizations.
* note: This is a boolean property stored as an integer, 0 is false
*/
public static final String AI_CONFIG_PP_OG_REMOVE_ANIMATIONS
= "pp.og.remove_anims";
}
/** Causes assimp to favour speed against import quality.
*
* Enabling this option may result in faster loading, but it needn't.
* It represents just a hint to loaders and post-processing steps to use
* faster code paths, if possible.
* This property is expected to be an integer, != 0 stands for true.
* The default value is 0.
*/
public static final String AI_CONFIG_FAVOUR_SPEED
= "imp.speed_flag";
};

View File

@ -1,11 +1,276 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2008, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
package assimp;
/**
* Created by IntelliJ IDEA.
* User: Alex
* Date: 09.10.2008
* Time: 13:54:04
* To change this template use File | Settings | File Templates.
/** Describes a virtual camera in the scene
*
* Cameras have a representation in the node graph and can be animated
*
* @author Aramis (Alexander Gessler)
* @version 1.0
*/
public class Light {
}
public class Light
{
/** Enumerates all supported types of light sources
*/
public class Type
{
// public static final int UNDEFINED = 0x0;
/** A directional light source has a well-defined direction
* but is infinitely far away. That's quite a good
* approximation for sun light.
* */
public static final int DIRECTIONAL = 0x1;
/** A point light source has a well-defined position
* in space but no direction - it emmits light in all
* directions. A normal bulb is a point light.
* */
public static final int POINT = 0x2;
/** A spot light source emmits light in a specific
* angle. It has a position and a direction it is pointing to.
* A good example for a spot light is a light spot in
* sport arenas.
* */
public static final int SPOT = 0x3;
};
/** The name of the light source.
*/
private String mName;
/** The type of the light source.
*/
private Type mType;
/** Position of the light source in space.
*/
private float[] mPosition;
/** Direction of the light source in space.
*/
private float[] mDirection;
/** Constant light attenuation factor.
*/
private float mAttenuationConstant;
/** Linear light attenuation factor.
*/
private float mAttenuationLinear;
/** Quadratic light attenuation factor.
*/
private float mAttenuationQuadratic;
/** Diffuse color of the light source
*/
private float[] mColorDiffuse;
/** Specular color of the light source
*/
private float[] mColorSpecular;
/** Ambient color of the light source
*/
private float[] mColorAmbient;
/** Inner angle of a spot light's light cone.
*/
private float mAngleInnerCone;
/** Outer angle of a spot light's light cone.
*/
private float mAngleOuterCone;
/** Get the name of the light source.
*
* There must be a node in the scenegraph with the same name.
* This node specifies the position of the light in the scene
* hierarchy and can be animated.
*/
public final String GetName()
{
return mName;
}
/** Get the type of the light source.
*
*/
public final Type GetType()
{
return mType;
}
/** Get the position of the light source in space. Relative to the
* transformation of the node corresponding to the light.
*
* The position is undefined for directional lights.
* @return Component order: x,y,z
*/
public final float[] GetPosition()
{
return mPosition;
}
/** Get the direction of the light source in space. Relative to the
* transformation of the node corresponding to the light.
*
* The direction is undefined for point lights. The vector
* may be normalized, but it needn't.
* @return Component order: x,y,z
*/
public final float[] GetDirection()
{
return mDirection;
}
/** Get the constant light attenuation factor.
*
* The intensity of the light source at a given distance 'd' from
* the light's position is
* @code
* Atten = 1/( att0 + att1 * d + att2 * d*d)
* @endcode
* This member corresponds to the att0 variable in the equation.
*/
public final float GetAttenuationConstant()
{
return mAttenuationConstant;
}
/** Get the linear light attenuation factor.
*
* The intensity of the light source at a given distance 'd' from
* the light's position is
* @code
* Atten = 1/( att0 + att1 * d + att2 * d*d)
* @endcode
* This member corresponds to the att1 variable in the equation.
*/
public final float GetAttenuationLinear()
{
return mAttenuationLinear;
}
/** Get the quadratic light attenuation factor.
*
* The intensity of the light source at a given distance 'd' from
* the light's position is
* @code
* Atten = 1/( att0 + att1 * d + att2 * d*d)
* @endcode
* This member corresponds to the att2 variable in the equation.
*/
public final float GetAttenuationQuadratic()
{
return mAttenuationQuadratic;
}
/** Get the diffuse color of the light source
*
* The diffuse light color is multiplied with the diffuse
* material color to obtain the final color that contributes
* to the diffuse shading term.
*/
public final float[] mColorDiffuse;
/** Get the specular color of the light source
*
* The specular light color is multiplied with the specular
* material color to obtain the final color that contributes
* to the specular shading term.
*/
public final float[] GetColorSpecular()
{
return mColorSpecular;
}
/** Get the ambient color of the light source
*
* The ambient light color is multiplied with the ambient
* material color to obtain the final color that contributes
* to the ambient shading term. Most renderers will ignore
* this value it, is just a remaining of the fixed-function pipeline
* that is still supported by quite many file formats.
*/
public final float[] GetColorAmbient()
{
return mColorAmbient;
}
/** Get the inner angle of a spot light's light cone.
*
* The spot light has maximum influence on objects inside this
* angle. The angle is given in radians. It is 2PI for point
* lights and undefined for directional lights.
*/
public final float GetAngleInnerCone()
{
return mAngleInnerCone;
}
/** Get the outer angle of a spot light's light cone.
*
* The spot light does not affect objects outside this angle.
* The angle is given in radians. It is 2PI for point lights and
* undefined for directional lights. The outer angle must be
* greater than or equal to the inner angle.
* It is assumed that the application uses a smooth
* interpolation between the inner and the outer cone of the
* spot light.
*/
public final float GetAngleOuterCone()
{
return mAngleOuterCone;
}
};