diff --git a/changelog_en.txt b/changelog.txt similarity index 75% rename from changelog_en.txt rename to changelog.txt index 355dbd6..60a4c8b 100644 --- a/changelog_en.txt +++ b/changelog.txt @@ -1,57 +1,52 @@ Changelog Alternativa3D -NEXT +8.32.0 ---- Added: -+ Added: -+ Object3DUtils: setPosition, lookAt to Camera3D and converting between Radians and Degrees -+ Stage3D constrained profile support -+ BitmapTextureResource: auto resize for GPU option -+ 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 ++ Basic Stage3D constrained profile support. ++ Object3D: added excludeLight() method for controlling light's influence on object. ++ BitmapTextureResource: added resizeForGPU option to turn on the automatic source bitmap resize. ++ Added support for right and middle mouse buttons in the mouse events system (work in FP 11.2 and swf-version >= 15). Fixed: -= Object3D.toString() -= AnimationClip: animated and loop properties in AnimationClip.slice(), AnimationClip.clone() -= Bubbling in MouseEvent3D -= ExporterA3D: export meshes without geometry as Object3D -= Box: correct tangents and binormals -= WireFrame:fix createBinormals() -= Decal: Fixed incorrect drawing with extremaly low nearClipping. -= View: Fixed bug with mouse events and postprosessing -= Several minor fixes += Mouse events system will be automatically disabled when there are no listeners in the scene. += StandardMaterial: optimized drawing with many lights. += Camera3D: optimized rendering with shadows. += Parser3DS: greatly reduced models parsing time. += Box: fixed incorrect vertices tangents and binormals data. += Decal: fixed incorrect appearance in the scene with small Camera3D nearClipping setting. += LOD: fixed operation of lights and occluders contained in it. += ExporterA3D: meshes without geometry will export as Object3D now. += AnimationClip: slice() and clone() methods will set animated and loop properties of new instance now. Removed: --Diagram: removed CPU time +- Diagram: removed CPU time. 8.31.0 --- -= Rendering optimizations -= Increased materials performance -= AnimationController:fixed error when using notifiers cause animation goes in infinite loop -= Camera3D: fixed a bug with duplicating diagram +Fixed: += Optimized scene rendering. += Increased materials performance. += AnimationController: fixed error when notifiers usage causes animation goes in infinite loop. += Camera3D: fixed a bug with duplicating diagram. 8.30.0 --- Fixed: -= OmniLightShadow: fixed some errors and increased performance -= ParserCollada: loading Skin without normals and tangents -= ParserA3D: parsing scene with spot lights -= DirectionalLigthShadow, OmniLightShadow:default value of biasMultiplyer property was changed to 0.97 -= StandardMaterial:removed traces += OmniLightShadow: fixed some errors and increased performance. += ParserCollada: Skin without normals and tangents will load fine now. += ParserA3D: fixed a bug with spot lights parsing. 8.29.0 --- Added: -+ Possibility to use unlimited light sources and shadows count with StandardMaterial -+ A flag Object3D.useShadow which controls shadow visibility on object. -+ OmniLightShadow class ++ StandardMaterial: added possibility to use unlimited number of light sources and shadows. ++ Object3D: added flag useShadow which controls influence of shadows on object. ++ Added OmniLightShadow class. Fixed: -= Fixed issue with Skin lighting -= StandardMaterial does not throw exception about limitation number of light sources and shadows anymore. += Fixed issue with Skin lighting. += StandardMaterial will not throw exception about the limitation on the number of lights and shadows anymore. 8.27.0 ---- @@ -146,7 +141,7 @@ Removed: - WireFrame class was added. - New class SkyBox was added. - StandardMaterial supports Object-space normal maps now. -- StandardMaterial supports glossiness maps now +- StandardMaterial supports glossiness maps now. - Property alwaysOnTop was added in the Sprite. - clone() method was added to Skin. - concatenatedMatrix property was added in Object3D. @@ -174,23 +169,23 @@ Removed: 8.5.0 ----- -- GPU support -- Directional, omni, spot lights -- Hierarchical exclusion of light sources -- Material with normal, specular, opacity mapping -- Lightmap Material -- Vertex light Material -- Fill Material -- Skin -- Skin subdividing -- Semi-transparent Material -- Mesh with several materials -- Sprite -- Animated Sprite -- GPU-based MouseEvents -- ATF textures loading -- Collada loading -- Binary A3D loading -- Drawing to DisplayObject mode -- Animation engine -- Hierarchical Animated blending tree +- GPU support. +- Directional, omni, spot lights. +- Hierarchical exclusion of light sources. +- Material with normal, specular, opacity mapping. +- Lightmap Material. +- Vertex light Material. +- Fill Material. +- Skin. +- Skin subdividing. +- Semi-transparent Material. +- Mesh with several materials. +- Sprite. +- Animated Sprite. +- GPU-based MouseEvents. +- ATF textures loading. +- Collada loading. +- Binary A3D loading. +- Drawing to DisplayObject mode. +- Animation engine. +- Hierarchical Animated blending tree. diff --git a/pom.xml b/pom.xml index 0e35ff7..07bc36a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ platform.clients.fp11.libraries Alternativa3D swc - 8.32.0-SNAPSHOT + 8.33.0-SNAPSHOT platform.clients.fp11.tools.maven BasePom diff --git a/src/alternativa/Alternativa3D.as b/src/alternativa/Alternativa3D.as index 06ca898..92d3944 100644 --- a/src/alternativa/Alternativa3D.as +++ b/src/alternativa/Alternativa3D.as @@ -17,6 +17,6 @@ package alternativa { /** * 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"; } } diff --git a/src/alternativa/engine3d/loaders/Parser3DS.as b/src/alternativa/engine3d/loaders/Parser3DS.as index 115bbea..e190312 100644 --- a/src/alternativa/engine3d/loaders/Parser3DS.as +++ b/src/alternativa/engine3d/loaders/Parser3DS.as @@ -51,7 +51,7 @@ package alternativa.engine3d.loaders { private var data:ByteArray; private var objectDatas:Object; - private var animationDatas:Array; + private var animationDatas:Vector.; private var materialDatas:Object; /** @@ -313,7 +313,7 @@ package alternativa.engine3d.loaders { case 0xB006: // spot target case 0xB007: if (animationDatas == null) { - animationDatas = new Array(); + animationDatas = new Vector.(); } var animation:AnimationData = new AnimationData(); animation.chunkId = chunkInfo.id; @@ -803,7 +803,7 @@ package alternativa.engine3d.loaders { } var vertices:Vector. = new Vector.(objectData.vertices.length/3); - var faces:Array = new Array(objectData.faces.length/3); // Vector. can't .sortOn() + var faces:Vector. = new Vector.(objectData.faces.length/3); buildInitialGeometry(vertices, faces, objectData, animationData, scale); @@ -884,7 +884,7 @@ package alternativa.engine3d.loaders { mesh.calculateBoundBox(); } - private function buildInitialGeometry(vertices:Vector., faces:Array, objectData:ObjectData, animationData:AnimationData, scale:Number):void { + private function buildInitialGeometry(vertices:Vector., faces:Vector., objectData:ObjectData, animationData:AnimationData, scale:Number):void { var correct:Boolean = false; if (animationData != null) { var a:Number = objectData.a; @@ -964,7 +964,7 @@ package alternativa.engine3d.loaders { } } - private function cloneVerticesToRespectSmoothGroups(vertices:Vector., faces:Array):void { + private function cloneVerticesToRespectSmoothGroups(vertices:Vector., faces:Vector.):void { // 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, 3 and 1+3, then it is not duplicated @@ -1040,7 +1040,7 @@ package alternativa.engine3d.loaders { } } - private function cloneAndTransformVerticesToRespectUVTransforms(vertices:Vector., faces:Array):void { + private function cloneAndTransformVerticesToRespectUVTransforms(vertices:Vector., faces:Vector.):void { // Actions with UV transformation // 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; @@ -1110,7 +1110,7 @@ package alternativa.engine3d.loaders { } } - private function calculateVertexNormals(vertices:Vector., faces:Array):void { + private function calculateVertexNormals(vertices:Vector., faces:Vector.):void { var n:int, m:int, numFaces:int = faces.length; for (n = 0; n < numFaces; n++) { var face:Face = Face(faces [n]); @@ -1157,7 +1157,7 @@ package alternativa.engine3d.loaders { } } - private function calculateVertexTangents(vertices:Vector., faces:Array):void { + private function calculateVertexTangents(vertices:Vector., faces:Vector.):void { var n:int, m:int, numVertices:int = vertices.length, numFaces:int = faces.length; for (n = 0; n < numFaces; 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., objectData:ObjectData):void { // Assign materials if (objectData.surfaces != null) { for (var key:String in objectData.surfaces) { @@ -1338,12 +1338,32 @@ package alternativa.engine3d.loaders { } } - private function collectFacesIntoSurfaces(faces:Array, defaultMaterialData:MaterialData):Vector. { + private function sortFacesBySurface(a:Vector., 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., defaultMaterialData:MaterialData):Vector. { + var numFaces:int = faces.length; // Sort faces on materials - faces.sortOn("surface"); + if (numFaces) sortFacesBySurface(faces, 0, numFaces - 1); // Create indices, calculate indexBegin and numTriangles - var numFaces:int = faces.length; var indices:Vector. = new Vector.(numFaces*3, true); var lastMaterialData:MaterialData; diff --git a/src/alternativa/engine3d/materials/StandardMaterial.as b/src/alternativa/engine3d/materials/StandardMaterial.as index f451c23..1faad5a 100644 --- a/src/alternativa/engine3d/materials/StandardMaterial.as +++ b/src/alternativa/engine3d/materials/StandardMaterial.as @@ -1076,9 +1076,6 @@ package alternativa.engine3d.materials { // Iterate groups var materialKey:int; var program:StandardMaterialProgram; - var omniLightCount:int = 0; - var directionalLightCount:int = 0; - var spotLightCount:int = 0; if (groupsCount == 0 && shadowGroupLength == 0) { // There is only Ambient light on the scene @@ -1121,9 +1118,14 @@ package alternativa.engine3d.materials { // Form key 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); + var omniLightCount:int = 0; + var directionalLightCount:int = 0; + var spotLightCount:int = 0; for (j = 0; j < lightGroupLength; 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 |= directionalLightCount << DIRECTIONAL_LIGHT_OFFSET; @@ -1170,7 +1172,9 @@ package alternativa.engine3d.materials { 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 |= 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 diff --git a/src/alternativa/engine3d/utils/Object3DUtils.as b/src/alternativa/engine3d/utils/Object3DUtils.as index 6aaa4f1..3808a6a 100644 --- a/src/alternativa/engine3d/utils/Object3DUtils.as +++ b/src/alternativa/engine3d/utils/Object3DUtils.as @@ -42,13 +42,8 @@ package alternativa.engine3d.utils { } /** - * Calculates a BoundBox of hierarchy of objects. - * - * @param object Container which contains the hierarchy. - * @param boundBoxSpace Object3D in coordinates of which the BoundBox will be calculated. - * @param result Instance of BoundBox to which calculated properties will be set. - * - * @return Instance given as result property with properties updated according to calculations. If result property was not set, new instance of BoundBox will be created. + * @private + * Performs calculation of bound box of objects hierarchy branch. */ public static function calculateHierarchyBoundBox(object:Object3D, boundBoxSpace:Object3D = null, result:BoundBox = null):BoundBox { if (result == null) result = new BoundBox();