Merge remote-tracking branch 'origin/master'

This commit is contained in:
Leonid Gaev
2012-08-31 17:52:24 +06:00
6 changed files with 94 additions and 80 deletions

View File

@@ -1,57 +1,52 @@
Changelog Alternativa3D Changelog Alternativa3D
NEXT 8.32.0
---- ----
Added: Added:
+ Added: + Basic Stage3D constrained profile support.
+ Object3DUtils: setPosition, lookAt to Camera3D and converting between Radians and Degrees + Object3D: added excludeLight() method for controlling light's influence on object.
+ Stage3D constrained profile support + BitmapTextureResource: added resizeForGPU option to turn on the automatic source bitmap resize.
+ BitmapTextureResource: auto resize for GPU option + Added support for right and middle mouse buttons in the mouse events system (work in FP 11.2 and swf-version >= 15).
+ MouseEvent3D: right and middle mouse buttons support (FP 11.2 and -swf-version=15 required)
+ Object3D: excludeLight()
+ OmniLightShadow: add omni radius in debug scale
+ Camera3D: light sorting
Fixed: Fixed:
= Object3D.toString() = Mouse events system will be automatically disabled when there are no listeners in the scene.
= AnimationClip: animated and loop properties in AnimationClip.slice(), AnimationClip.clone() = StandardMaterial: optimized drawing with many lights.
= Bubbling in MouseEvent3D = Camera3D: optimized rendering with shadows.
= ExporterA3D: export meshes without geometry as Object3D = Parser3DS: greatly reduced models parsing time.
= Box: correct tangents and binormals = Box: fixed incorrect vertices tangents and binormals data.
= WireFrame:fix createBinormals() = Decal: fixed incorrect appearance in the scene with small Camera3D nearClipping setting.
= Decal: Fixed incorrect drawing with extremaly low nearClipping. = LOD: fixed operation of lights and occluders contained in it.
= View: Fixed bug with mouse events and postprosessing = ExporterA3D: meshes without geometry will export as Object3D now.
= Several minor fixes = AnimationClip: slice() and clone() methods will set animated and loop properties of new instance now.
Removed: Removed:
-Diagram: removed CPU time - Diagram: removed CPU time.
8.31.0 8.31.0
--- ---
= Rendering optimizations Fixed:
= Increased materials performance = Optimized scene rendering.
= AnimationController:fixed error when using notifiers cause animation goes in infinite loop = Increased materials performance.
= Camera3D: fixed a bug with duplicating diagram = AnimationController: fixed error when notifiers usage causes animation goes in infinite loop.
= Camera3D: fixed a bug with duplicating diagram.
8.30.0 8.30.0
--- ---
Fixed: Fixed:
= OmniLightShadow: fixed some errors and increased performance = OmniLightShadow: fixed some errors and increased performance.
= ParserCollada: loading Skin without normals and tangents = ParserCollada: Skin without normals and tangents will load fine now.
= ParserA3D: parsing scene with spot lights = ParserA3D: fixed a bug with spot lights parsing.
= DirectionalLigthShadow, OmniLightShadow:default value of biasMultiplyer property was changed to 0.97
= StandardMaterial:removed traces
8.29.0 8.29.0
--- ---
Added: Added:
+ Possibility to use unlimited light sources and shadows count with StandardMaterial + StandardMaterial: added possibility to use unlimited number of light sources and shadows.
+ A flag Object3D.useShadow which controls shadow visibility on object. + Object3D: added flag useShadow which controls influence of shadows on object.
+ OmniLightShadow class + Added OmniLightShadow class.
Fixed: Fixed:
= Fixed issue with Skin lighting = Fixed issue with Skin lighting.
= StandardMaterial does not throw exception about limitation number of light sources and shadows anymore. = StandardMaterial will not throw exception about the limitation on the number of lights and shadows anymore.
8.27.0 8.27.0
---- ----
@@ -146,7 +141,7 @@ Removed:
- WireFrame class was added. - WireFrame class was added.
- New class SkyBox was added. - New class SkyBox was added.
- StandardMaterial supports Object-space normal maps now. - StandardMaterial supports Object-space normal maps now.
- StandardMaterial supports glossiness maps now - StandardMaterial supports glossiness maps now.
- Property alwaysOnTop was added in the Sprite. - Property alwaysOnTop was added in the Sprite.
- clone() method was added to Skin. - clone() method was added to Skin.
- concatenatedMatrix property was added in Object3D. - concatenatedMatrix property was added in Object3D.
@@ -174,23 +169,23 @@ Removed:
8.5.0 8.5.0
----- -----
- GPU support - GPU support.
- Directional, omni, spot lights - Directional, omni, spot lights.
- Hierarchical exclusion of light sources - Hierarchical exclusion of light sources.
- Material with normal, specular, opacity mapping - Material with normal, specular, opacity mapping.
- Lightmap Material - Lightmap Material.
- Vertex light Material - Vertex light Material.
- Fill Material - Fill Material.
- Skin - Skin.
- Skin subdividing - Skin subdividing.
- Semi-transparent Material - Semi-transparent Material.
- Mesh with several materials - Mesh with several materials.
- Sprite - Sprite.
- Animated Sprite - Animated Sprite.
- GPU-based MouseEvents - GPU-based MouseEvents.
- ATF textures loading - ATF textures loading.
- Collada loading - Collada loading.
- Binary A3D loading - Binary A3D loading.
- Drawing to DisplayObject mode - Drawing to DisplayObject mode.
- Animation engine - Animation engine.
- Hierarchical Animated blending tree - Hierarchical Animated blending tree.

View File

@@ -3,7 +3,7 @@
<groupId>platform.clients.fp11.libraries</groupId> <groupId>platform.clients.fp11.libraries</groupId>
<artifactId>Alternativa3D</artifactId> <artifactId>Alternativa3D</artifactId>
<packaging>swc</packaging> <packaging>swc</packaging>
<version>8.32.0-SNAPSHOT</version> <version>8.33.0-SNAPSHOT</version>
<parent> <parent>
<groupId>platform.clients.fp11.tools.maven</groupId> <groupId>platform.clients.fp11.tools.maven</groupId>
<artifactId>BasePom</artifactId> <artifactId>BasePom</artifactId>

View File

@@ -17,6 +17,6 @@ package alternativa {
/** /**
* Library version in the format: generation.feature-version.fix-version. * Library version in the format: generation.feature-version.fix-version.
*/ */
public static const version:String = "8.31.0"; public static const version:String = "8.32.0";
} }
} }

View File

@@ -51,7 +51,7 @@ package alternativa.engine3d.loaders {
private var data:ByteArray; private var data:ByteArray;
private var objectDatas:Object; private var objectDatas:Object;
private var animationDatas:Array; private var animationDatas:Vector.<AnimationData>;
private var materialDatas:Object; private var materialDatas:Object;
/** /**
@@ -313,7 +313,7 @@ package alternativa.engine3d.loaders {
case 0xB006: // spot target case 0xB006: // spot target
case 0xB007: case 0xB007:
if (animationDatas == null) { if (animationDatas == null) {
animationDatas = new Array(); animationDatas = new Vector.<AnimationData>();
} }
var animation:AnimationData = new AnimationData(); var animation:AnimationData = new AnimationData();
animation.chunkId = chunkInfo.id; animation.chunkId = chunkInfo.id;
@@ -803,7 +803,7 @@ package alternativa.engine3d.loaders {
} }
var vertices:Vector.<Vertex> = new Vector.<Vertex>(objectData.vertices.length/3); var vertices:Vector.<Vertex> = new Vector.<Vertex>(objectData.vertices.length/3);
var faces:Array = new Array(objectData.faces.length/3); // Vector.<Face> can't .sortOn() var faces:Vector.<Face> = new Vector.<Face>(objectData.faces.length/3);
buildInitialGeometry(vertices, faces, objectData, animationData, scale); buildInitialGeometry(vertices, faces, objectData, animationData, scale);
@@ -884,7 +884,7 @@ package alternativa.engine3d.loaders {
mesh.calculateBoundBox(); mesh.calculateBoundBox();
} }
private function buildInitialGeometry(vertices:Vector.<Vertex>, faces:Array, objectData:ObjectData, animationData:AnimationData, scale:Number):void { private function buildInitialGeometry(vertices:Vector.<Vertex>, faces:Vector.<Face>, objectData:ObjectData, animationData:AnimationData, scale:Number):void {
var correct:Boolean = false; var correct:Boolean = false;
if (animationData != null) { if (animationData != null) {
var a:Number = objectData.a; var a:Number = objectData.a;
@@ -964,7 +964,7 @@ package alternativa.engine3d.loaders {
} }
} }
private function cloneVerticesToRespectSmoothGroups(vertices:Vector.<Vertex>, faces:Array):void { private function cloneVerticesToRespectSmoothGroups(vertices:Vector.<Vertex>, faces:Vector.<Face>):void {
// Actions with smoothing groups: // Actions with smoothing groups:
// - if vertex is in faces with groups 1+2 and 3, then it is duplicated // - if vertex is in faces with groups 1+2 and 3, then it is duplicated
// - if vertex is in faces with groups 1+2, 3 and 1+3, then it is not duplicated // - if vertex is in faces with groups 1+2, 3 and 1+3, then it is not duplicated
@@ -1040,7 +1040,7 @@ package alternativa.engine3d.loaders {
} }
} }
private function cloneAndTransformVerticesToRespectUVTransforms(vertices:Vector.<Vertex>, faces:Array):void { private function cloneAndTransformVerticesToRespectUVTransforms(vertices:Vector.<Vertex>, faces:Vector.<Face>):void {
// Actions with UV transformation // Actions with UV transformation
// if vertex in faces with different transform materials, then it is duplicated // if vertex in faces with different transform materials, then it is duplicated
var n:int, m:int, p:int, q:int, len:int, numVertices:int = vertices.length, numFaces:int = faces.length; var n:int, m:int, p:int, q:int, len:int, numVertices:int = vertices.length, numFaces:int = faces.length;
@@ -1110,7 +1110,7 @@ package alternativa.engine3d.loaders {
} }
} }
private function calculateVertexNormals(vertices:Vector.<Vertex>, faces:Array):void { private function calculateVertexNormals(vertices:Vector.<Vertex>, faces:Vector.<Face>):void {
var n:int, m:int, numFaces:int = faces.length; var n:int, m:int, numFaces:int = faces.length;
for (n = 0; n < numFaces; n++) { for (n = 0; n < numFaces; n++) {
var face:Face = Face(faces [n]); var face:Face = Face(faces [n]);
@@ -1157,7 +1157,7 @@ package alternativa.engine3d.loaders {
} }
} }
private function calculateVertexTangents(vertices:Vector.<Vertex>, faces:Array):void { private function calculateVertexTangents(vertices:Vector.<Vertex>, faces:Vector.<Face>):void {
var n:int, m:int, numVertices:int = vertices.length, numFaces:int = faces.length; var n:int, m:int, numVertices:int = vertices.length, numFaces:int = faces.length;
for (n = 0; n < numFaces; n++) { for (n = 0; n < numFaces; n++) {
var face:Face = Face(faces [n]); var face:Face = Face(faces [n]);
@@ -1319,7 +1319,7 @@ package alternativa.engine3d.loaders {
} }
} }
private function assignMaterialsToFaces(faces:Array, objectData:ObjectData):void { private function assignMaterialsToFaces(faces:Vector.<Face>, objectData:ObjectData):void {
// Assign materials // Assign materials
if (objectData.surfaces != null) { if (objectData.surfaces != null) {
for (var key:String in objectData.surfaces) { for (var key:String in objectData.surfaces) {
@@ -1338,12 +1338,32 @@ package alternativa.engine3d.loaders {
} }
} }
private function collectFacesIntoSurfaces(faces:Array, defaultMaterialData:MaterialData):Vector.<uint> { private function sortFacesBySurface(a:Vector.<Face>, left:int, right:int):void {
var pivot:uint, tmp:Face;
var i:int = left;
var j:int = right;
pivot = a[int((left + right) >> 1)].surface;
while (i <= j) {
while (a[i].surface < pivot) i++;
while (a[j].surface > pivot) j--;
if (i <= j) {
tmp = a[i];
a[i] = a[j];
i++;
a[j] = tmp;
j--;
}
}
if (left < j) sortFacesBySurface(a, left, j);
if (i < right) sortFacesBySurface(a, i, right);
}
private function collectFacesIntoSurfaces(faces:Vector.<Face>, defaultMaterialData:MaterialData):Vector.<uint> {
var numFaces:int = faces.length;
// Sort faces on materials // Sort faces on materials
faces.sortOn("surface"); if (numFaces) sortFacesBySurface(faces, 0, numFaces - 1);
// Create indices, calculate indexBegin and numTriangles // Create indices, calculate indexBegin and numTriangles
var numFaces:int = faces.length;
var indices:Vector.<uint> = new Vector.<uint>(numFaces*3, true); var indices:Vector.<uint> = new Vector.<uint>(numFaces*3, true);
var lastMaterialData:MaterialData; var lastMaterialData:MaterialData;

View File

@@ -1076,9 +1076,6 @@ package alternativa.engine3d.materials {
// Iterate groups // Iterate groups
var materialKey:int; var materialKey:int;
var program:StandardMaterialProgram; var program:StandardMaterialProgram;
var omniLightCount:int = 0;
var directionalLightCount:int = 0;
var spotLightCount:int = 0;
if (groupsCount == 0 && shadowGroupLength == 0) { if (groupsCount == 0 && shadowGroupLength == 0) {
// There is only Ambient light on the scene // There is only Ambient light on the scene
@@ -1121,9 +1118,14 @@ package alternativa.engine3d.materials {
// Form key // Form key
materialKey = (isFirstGroup) ? ((lightMap != null) ? LIGHT_MAP_BIT : 0) : 0; materialKey = (isFirstGroup) ? ((lightMap != null) ? LIGHT_MAP_BIT : 0) : 0;
materialKey |= (_normalMapSpace << NORMAL_MAP_SPACE_OFFSET) | ((glossinessMap != null) ? GLOSSINESS_MAP_BIT : 0) | ((specularMap != null) ? SPECULAR_MAP_BIT : 0); materialKey |= (_normalMapSpace << NORMAL_MAP_SPACE_OFFSET) | ((glossinessMap != null) ? GLOSSINESS_MAP_BIT : 0) | ((specularMap != null) ? SPECULAR_MAP_BIT : 0);
var omniLightCount:int = 0;
var directionalLightCount:int = 0;
var spotLightCount:int = 0;
for (j = 0; j < lightGroupLength; j++) { for (j = 0; j < lightGroupLength; j++) {
light = lightGroup[j]; light = lightGroup[j];
if (light is OmniLight) omniLightCount++; else if (light is DirectionalLight) directionalLightCount++; else if (light is SpotLight) spotLightCount++; if (light is OmniLight) omniLightCount++;
else if (light is DirectionalLight) directionalLightCount++;
else if (light is SpotLight) spotLightCount++;
} }
materialKey |= omniLightCount << OMNI_LIGHT_OFFSET; materialKey |= omniLightCount << OMNI_LIGHT_OFFSET;
materialKey |= directionalLightCount << DIRECTIONAL_LIGHT_OFFSET; materialKey |= directionalLightCount << DIRECTIONAL_LIGHT_OFFSET;
@@ -1170,7 +1172,9 @@ package alternativa.engine3d.materials {
materialKey = (isFirstGroup) ? ((lightMap != null) ? LIGHT_MAP_BIT : 0) : 0; materialKey = (isFirstGroup) ? ((lightMap != null) ? LIGHT_MAP_BIT : 0) : 0;
materialKey |= (_normalMapSpace << NORMAL_MAP_SPACE_OFFSET) | ((glossinessMap != null) ? GLOSSINESS_MAP_BIT : 0) | ((specularMap != null) ? SPECULAR_MAP_BIT : 0); materialKey |= (_normalMapSpace << NORMAL_MAP_SPACE_OFFSET) | ((glossinessMap != null) ? GLOSSINESS_MAP_BIT : 0) | ((specularMap != null) ? SPECULAR_MAP_BIT : 0);
materialKey |= light.shadow.type << SHADOW_OFFSET; materialKey |= light.shadow.type << SHADOW_OFFSET;
if (light is OmniLight) materialKey |= 1 << OMNI_LIGHT_OFFSET; else if (light is DirectionalLight) materialKey |= 1 << DIRECTIONAL_LIGHT_OFFSET; else if (light is SpotLight) materialKey |= 1 << SPOT_LIGHT_OFFSET; if (light is OmniLight) materialKey |= 1 << OMNI_LIGHT_OFFSET;
else if (light is DirectionalLight) materialKey |= 1 << DIRECTIONAL_LIGHT_OFFSET;
else if (light is SpotLight) materialKey |= 1 << SPOT_LIGHT_OFFSET;
// Для группы создаем программу и дроуюнит // Для группы создаем программу и дроуюнит
// Opaque pass // Opaque pass

View File

@@ -42,13 +42,8 @@ package alternativa.engine3d.utils {
} }
/** /**
* Calculates a BoundBox of hierarchy of objects. * @private
* * Performs calculation of bound box of objects hierarchy branch.
* @param object Container which contains the hierarchy.
* @param boundBoxSpace <code>Object3D</code> in coordinates of which the BoundBox will be calculated.
* @param result Instance of <code>BoundBox</code> to which calculated properties will be set.
*
* @return Instance given as <code>result</code> property with properties updated according to calculations. If <code>result</code> property was not set, new instance of <code>BoundBox</code> will be created.
*/ */
public static function calculateHierarchyBoundBox(object:Object3D, boundBoxSpace:Object3D = null, result:BoundBox = null):BoundBox { public static function calculateHierarchyBoundBox(object:Object3D, boundBoxSpace:Object3D = null, result:BoundBox = null):BoundBox {
if (result == null) result = new BoundBox(); if (result == null) result = new BoundBox();