From 2a49523fd8e0ed71740807b5f242b259c7e4fdcd Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Thu, 5 Dec 2013 18:34:20 -0800 Subject: [PATCH] =?UTF-8?q?-=20I=20have=20replaced=20the=20lines=20inserte?= =?UTF-8?q?d=20in=20to=20KRResource+Fbx=20that=20look=20for=20=E2=80=9Ccol?= =?UTF-8?q?lider=5Fso=5F=E2=80=9D=20with=20logic=20to=20look=20for=20?= =?UTF-8?q?=E2=80=9Ccollider=5F##=5F=E2=80=9D.=20=20This=20means=20that=20?= =?UTF-8?q?Jonny=20will=20need=20to=20name=20the=20flare=20height=20collid?= =?UTF-8?q?ers=20with=20a=20prefix=20of=20=E2=80=9Ccollider=5F16=5F?= =?UTF-8?q?=E2=80=9D=20in=20the=20Circa=201948=20project.=20-=20The=20code?= =?UTF-8?q?=20block=20starting=20with=20=E2=80=9CINTERRUPT=20THE=20NODE=20?= =?UTF-8?q?STUFF=20IN=20HERE=E2=80=9D=20has=20been=20moved=20to=20KRImport?= =?UTF-8?q?=20where=20it=20should=20occur.=20=20I=20have=20added=20an=20ex?= =?UTF-8?q?ample=20in=20there=20on=20-=20Removed=20the=20comments,=20?= =?UTF-8?q?=E2=80=9C*****=20curves=201,=202,=20and=203=20are=20x,=20y,=20z?= =?UTF-8?q?=20translation=20..=20the=20first=20point=20holds=20the=20key?= =?UTF-8?q?=20frame=20in=20centimeters.=20=20POSSIBLE=20UPGRADE=20..=20gra?= =?UTF-8?q?b=20the=20key=20frame=20and=20output=20it=20as=20the=20start=20?= =?UTF-8?q?location=20to=20the=20kranimation=20file=E2=80=9D,=20as=20this?= =?UTF-8?q?=20is=20incorrect=20and=20misleading.=20=20You=20must=20never?= =?UTF-8?q?=20depend=20on=20the=20order=20of=20the=20curves=20in=20the=20F?= =?UTF-8?q?BX=20file.=20=20The=20exporting=20of=20the=20first=20point=20in?= =?UTF-8?q?=20the=20animation=20curve=20should=20be=20done=20in=20KRImport?= =?UTF-8?q?,=20after=20Kraken=20has=20already=20resolved=20the=20animation?= =?UTF-8?q?=20layers=20and=20attribute=20assignments=20using=20proper=20me?= =?UTF-8?q?tadata=20in=20the=20fbx=20file.=20=20You=20can=20do=20this=20us?= =?UTF-8?q?ing=20the=20existing=20Kraken=20API=20rather=20than=20modifying?= =?UTF-8?q?=20Kraken=20itself.=20=20In=20addition,=20we=20can=E2=80=99t=20?= =?UTF-8?q?make=20any=20assumptions=20based=20on=20the=20first=20keyframe?= =?UTF-8?q?=20time=20matching=20the=20animation=20start=20time.=20=20The?= =?UTF-8?q?=20actual=20animation=20start=20time=20is=20imported=20by=20Kra?= =?UTF-8?q?ken=20using=20the=20FBX=20fields=20that=20explicitly=20specify?= =?UTF-8?q?=20it.=20=20The=20reason=20we=20read=20animation=20start=20and?= =?UTF-8?q?=20end=20times=20from=20a=20text=20file=20is=20to=20split=20the?= =?UTF-8?q?=20animation=20into=20multiple=20animations=20from=20a=20single?= =?UTF-8?q?=20fbx=20file.=20=20KRImport=20can=20already=20export=20a=20sin?= =?UTF-8?q?gle=20animation=20from=20an=20fbx=20file=20automatically=20simp?= =?UTF-8?q?ly=20by=20not=20specifying=20an=20animation=20split=20file.=20-?= =?UTF-8?q?=20Removed=20comment,=20=E2=80=9C//=20****=20this=20is=20where?= =?UTF-8?q?=20the=20assert=20used=20to=20happen=E2=80=9D.=20=20This=20comm?= =?UTF-8?q?ent=20adds=20no=20value=20and=20is=20confusing=20to=20other=20K?= =?UTF-8?q?raken=20users,=20as=20the=20assert=20does=20not=20happen=20any?= =?UTF-8?q?=20more=20;-)=20-=20Removed=20comment,=20=E2=80=9C//=20KRNode?= =?UTF-8?q?=20*LoadMesh=20parses=20the=20"collider=20names"=20and=20then?= =?UTF-8?q?=20alters=20the=20attributes=20(NFB=20HACK)=E2=80=9D.=20=20I=20?= =?UTF-8?q?have=20refactored=20this=20code=20so=20this=20is=20no=20longer?= =?UTF-8?q?=20a=20hack.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : nfb --- KREngine/Kraken.xcodeproj/project.pbxproj | 32 ---- KREngine/kraken/ImporterAudioLists.cpp | 212 ---------------------- KREngine/kraken/ImporterAudioLists.h | 123 ------------- KREngine/kraken/KRCollider.h | 1 - KREngine/kraken/KRResource+fbx.cpp | 121 ++---------- KREngine/kraken/simpleList.cpp | 87 --------- KREngine/kraken/simpleList.h | 35 ---- 7 files changed, 20 insertions(+), 591 deletions(-) delete mode 100644 KREngine/kraken/ImporterAudioLists.cpp delete mode 100644 KREngine/kraken/ImporterAudioLists.h delete mode 100644 KREngine/kraken/simpleList.cpp delete mode 100644 KREngine/kraken/simpleList.h diff --git a/KREngine/Kraken.xcodeproj/project.pbxproj b/KREngine/Kraken.xcodeproj/project.pbxproj index 6bac602..eef1240 100644 --- a/KREngine/Kraken.xcodeproj/project.pbxproj +++ b/KREngine/Kraken.xcodeproj/project.pbxproj @@ -10,14 +10,6 @@ 104A335E1672D31C001C8BA6 /* KRCollider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 104A335C1672D31B001C8BA6 /* KRCollider.cpp */; }; 104A335F1672D31C001C8BA6 /* KRCollider.h in Headers */ = {isa = PBXBuildFile; fileRef = 104A335D1672D31C001C8BA6 /* KRCollider.h */; settings = {ATTRIBUTES = (); }; }; 10CC33A5168534F000BB9846 /* KRCamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E48B3CBF14393E2F000C50E2 /* KRCamera.cpp */; }; - 500CB1E5185113DA0097F31B /* simpleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50B6C531185111C600047FF8 /* simpleList.cpp */; }; - 500CB1E6185113E60097F31B /* ImporterAudioLists.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50B6C52F185111C600047FF8 /* ImporterAudioLists.cpp */; }; - 500CB1ED185115280097F31B /* ImporterAudioLists.h in Headers */ = {isa = PBXBuildFile; fileRef = 500CB1EB185115280097F31B /* ImporterAudioLists.h */; }; - 500CB1EE185115280097F31B /* simpleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 500CB1EC185115280097F31B /* simpleList.h */; }; - 500CB1F5185117600097F31B /* simpleList.h in Headers */ = {isa = PBXBuildFile; fileRef = 500CB1EC185115280097F31B /* simpleList.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 500CB1F61851176D0097F31B /* ImporterAudioLists.h in Headers */ = {isa = PBXBuildFile; fileRef = 500CB1EB185115280097F31B /* ImporterAudioLists.h */; }; - 50B6C533185111C600047FF8 /* ImporterAudioLists.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50B6C52F185111C600047FF8 /* ImporterAudioLists.cpp */; }; - 50B6C535185111C600047FF8 /* simpleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50B6C531185111C600047FF8 /* simpleList.cpp */; }; E4030E4C160A3CF000592648 /* KRStockGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = E4030E4B160A3CF000592648 /* KRStockGeometry.h */; settings = {ATTRIBUTES = (); }; }; E4030E4D160A3CF000592648 /* KRStockGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = E4030E4B160A3CF000592648 /* KRStockGeometry.h */; settings = {ATTRIBUTES = (Public, ); }; }; E40BA45415EFF79500D7C3DD /* KRAABB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40BA45215EFF79500D7C3DD /* KRAABB.cpp */; }; @@ -416,10 +408,6 @@ 104A335C1672D31B001C8BA6 /* KRCollider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = KRCollider.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 104A335D1672D31C001C8BA6 /* KRCollider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRCollider.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 10CC33A3168530A300BB9846 /* libPVRTexLib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPVRTexLib.a; path = Utilities/PVRTexLib/MacOS/libPVRTexLib.a; sourceTree = PVRSDK; }; - 500CB1EB185115280097F31B /* ImporterAudioLists.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImporterAudioLists.h; sourceTree = ""; }; - 500CB1EC185115280097F31B /* simpleList.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = simpleList.h; sourceTree = ""; }; - 50B6C52F185111C600047FF8 /* ImporterAudioLists.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = ImporterAudioLists.cpp; sourceTree = ""; }; - 50B6C531185111C600047FF8 /* simpleList.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = simpleList.cpp; sourceTree = ""; }; E4030E4B160A3CF000592648 /* KRStockGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRStockGeometry.h; sourceTree = ""; }; E40BA45215EFF79500D7C3DD /* KRAABB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRAABB.cpp; sourceTree = ""; }; E40BA45315EFF79500D7C3DD /* KRAABB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRAABB.h; sourceTree = ""; }; @@ -720,17 +708,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 50B6C52E1851117A00047FF8 /* Audio Import */ = { - isa = PBXGroup; - children = ( - 50B6C52F185111C600047FF8 /* ImporterAudioLists.cpp */, - 500CB1EB185115280097F31B /* ImporterAudioLists.h */, - 50B6C531185111C600047FF8 /* simpleList.cpp */, - 500CB1EC185115280097F31B /* simpleList.h */, - ); - name = "Audio Import"; - sourceTree = ""; - }; E414F9A21694D949000B3D58 /* Unknown */ = { isa = PBXGroup; children = ( @@ -1079,7 +1056,6 @@ E491016613C99B9E0098455B /* kraken */ = { isa = PBXGroup; children = ( - 50B6C52E1851117A00047FF8 /* Audio Import */, E4F9753815362A5200FD60B2 /* 3rdparty */, E488399915F92BA300BD66D5 /* Managers */, E461A173152E59DF00F2044A /* Math */, @@ -1283,7 +1259,6 @@ E468448117FFDF51001F1FA1 /* KRLocator.h in Headers */, E43F70E71824D9AB00136169 /* KRTextureStreamer.h in Headers */, E4F975321536220900FD60B2 /* KRNode.h in Headers */, - 500CB1EE185115280097F31B /* simpleList.h in Headers */, E46C214715364BC8009CABF3 /* tinyxml2.h in Headers */, E48C696F15374F5B00232E28 /* KRContext.h in Headers */, E46F4A0B155E002100CCF8B8 /* KRDataBlock.h in Headers */, @@ -1334,7 +1309,6 @@ E48CF944173453990005EBBB /* KRFloat.h in Headers */, E43F71011824E73100136169 /* KRMeshStreamer.h in Headers */, E45134B81746A4A300443C21 /* KRBehavior.h in Headers */, - 500CB1ED185115280097F31B /* ImporterAudioLists.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1377,7 +1351,6 @@ E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */, E4AFC6B615F7C46800DDB4C8 /* KRAABB.cpp in Headers */, E428C3171669A24B00A16EDF /* KRAnimationAttribute.h in Headers */, - 500CB1F5185117600097F31B /* simpleList.h in Headers */, E4AFC6BE15F7C9E600DDB4C8 /* KROctreeNode.h in Headers */, E4AFC6BD15F7C9DA00DDB4C8 /* KROctree.h in Headers */, E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */, @@ -1421,7 +1394,6 @@ E48CF945173453990005EBBB /* KRFloat.h in Headers */, E499BF1F16AE753E007FCDBE /* KRCollider.h in Headers */, E499BF2316AE7636007FCDBE /* kraken-prefix.pch in Headers */, - 500CB1F61851176D0097F31B /* ImporterAudioLists.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1635,7 +1607,6 @@ E43F70DC181B20E400136169 /* KRLODSet.cpp in Sources */, E414BAE51435558900A668C4 /* KRModel.cpp in Sources */, E414BAE91435585A00A668C4 /* KRScene.cpp in Sources */, - 500CB1E5185113DA0097F31B /* simpleList.cpp in Sources */, E48B3CC014393E30000C50E2 /* KRCamera.cpp in Sources */, E497B946151BA99500D3DC67 /* KRVector2.cpp in Sources */, E497B94D151BCF2500D3DC67 /* KRResource.cpp in Sources */, @@ -1661,7 +1632,6 @@ E4B175AC161F5A1000B8FB80 /* KRTexture.cpp in Sources */, E4B175B2161F5FAF00B8FB80 /* KRTextureCube.cpp in Sources */, E4CA10E91637BD2B005D9400 /* KRTexturePVR.cpp in Sources */, - 500CB1E6185113E60097F31B /* ImporterAudioLists.cpp in Sources */, E4CA10EF1637BD58005D9400 /* KRTextureTGA.cpp in Sources */, E4CA11781639CC90005D9400 /* KRViewport.cpp in Sources */, E4324BA816444C230043185B /* KRParticleSystem.cpp in Sources */, @@ -1736,8 +1706,6 @@ E46A6B6D1559E97D000DBD37 /* KRResource+blend.cpp in Sources */, E40F982D184A7A2700CFA4D8 /* KRMeshQuad.cpp in Sources */, E46F4A0F155E003000CCF8B8 /* KRDataBlock.cpp in Sources */, - 50B6C533185111C600047FF8 /* ImporterAudioLists.cpp in Sources */, - 50B6C535185111C600047FF8 /* simpleList.cpp in Sources */, E42CB1F1158446AB0066E0D8 /* KRQuaternion.cpp in Sources */, E4AFC6BB15F7C7D600DDB4C8 /* KROctreeNode.cpp in Sources */, E43B0AD715DDCA0F00A5CB9F /* KRContextObject.cpp in Sources */, diff --git a/KREngine/kraken/ImporterAudioLists.cpp b/KREngine/kraken/ImporterAudioLists.cpp deleted file mode 100644 index 5b1917a..0000000 --- a/KREngine/kraken/ImporterAudioLists.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// -// ImporterAudioLists.cpp -// - -#include "ImporterAudioLists.h" - -// -// (1) UTILITIES -void IMPORTER_AUDIO_UTILITIES() { } - -// -// Utility to convert a file code from a resource file into an object id -// will convert to -// H will convert to << 8 -// A will convert to << 16 -// A result of 0 implies a bad input code -// - -unsigned long codeToID(char *code) -{ - static char decode[64]; - size_t l = strlen(code); - if (l <= 0) return 0; // no code string - if (l > 63) l = 63; - int type = 0; - switch (code[l-1]) { - case 'A' : - case 'a' : - type = 8; - case 'H' : - case 'h' : - type += 8; - strncpy(decode, code, l-1); // (dst, src, maxlength) - decode[l-1] = 0; - break; - default : - strncpy(decode, code, l); - decode[l] = 0; - break; - }; - unsigned long id = strtol(decode, 0, 0); // (str, endptr, base) - id = id << type; - return id; -} - -// -// (2) ZONE CORNERS -void IMPORTER_AUDIO_ZONE_CORNERS() { } - -// -// (2a) A corners list for a given room/space - -void zoneRoomCornersList::addCorner(zoneCorner *c) -{ -} - -void zoneRoomCornersList::generateZones(simpleList *zonelist) -{ -} - -// -// (2b) A list of all the corners lists - -void zoneAllCornersList::addCorner(zoneCorner *c) -{ -} - -void zoneAllCornersList::generateSpheresFor(unsigned long id, simpleList *zonelist) -{ -} - -void zoneAllCornersList::generateSpheres(simpleList *zonelist) -{ -} - -// -// (3) RESOURCES -void IMPORTER_AUDIO_RESOURCES() { } - -bool zoneResourceList::load(char *path1, char *path2) -{ - return true; -} - -// -// (4) ZONE NODE MANAGER -void IMPORTER_AUDIO_MANAGER() { } - -zoneNodeManager::zoneNodeManager() -{ -} - -zoneNodeManager::~zoneNodeManager() -{ -} - -// (1) parse the resource files and create the resource list -bool zoneNodeManager::loadResources(char *path1, char *path2) -{ - return resources.load(path1, path2); -} - -// (2) given a locator add it to the correct list - -// -// insert vector table list into this space! - -bool addLocator_audioNode(zoneNodeManager *manager, char *idstring, KRVector3 where, double radius) -{ - return true; -} - -bool addLocator_ambientZone(zoneNodeManager *manager, char *idstring, KRVector3 where, double radius) -{ - return true; -} - -bool addLocator_reverbZone(zoneNodeManager *manager, char *idstring, KRVector3 where, double radius) -{ - return true; -} - -bool addLocator_ambientCorner(zoneNodeManager *manager, char *idstring, KRVector3 where, double radius) -{ - return true; -} - -bool addLocator_reverbCorner(zoneNodeManager *manager, char *idstring, KRVector3 where, double radius) -{ - return true; -} - -typedef bool (*addLocatorFunction)(zoneNodeManager *, char *, KRVector3, double); - -typedef struct { - const char *prefix; - unsigned long prefix_length; - addLocatorFunction function; -} addLocatorTableItem; - -addLocatorTableItem addLocatorVectorTable[] = { - { "AN_", 3, addLocator_audioNode }, - { "AZpoint_", 8, addLocator_ambientZone }, - { "RZpoint_", 8, addLocator_reverbZone }, - { "AZcorner_", 9, addLocator_ambientCorner }, - { "RZcorner_", 9, addLocator_reverbCorner }, - { NULL, 0, NULL }, -}; - -addLocatorTableItem *addLocator_findType(char *name) -{ - addLocatorTableItem *result = addLocatorVectorTable; - while (NULL != result->prefix) - { - if (0 == strncmp(result->prefix, name, result->prefix_length)) return result; - result++; - } - return NULL; -} - - -bool zoneNodeManager::addLocatorToAList(char *name, KRVector3 point, double radius) -{ - // (1) parse the name and add it to a list where appropriate - // AN__ is an audio node - // AZpoint__ is an audio zone point with a radius - // RZpoint_

_ is a reverb zone point with a radius - // AZcorner__ is a corner for an ambient zone - // RZcorner_

_ is a corner for a reverb zone - // - - addLocatorTableItem *item = addLocator_findType(name); - if (NULL != item) - { - //**** IN HERE we want to parse the args into the ID arg and the unique/order arg - //**** UPDATE (*addLocatorFunction) to handle the 'order' arg - char arg[AUDIO_IMPORTER_STRLEN]; - strncpy(arg, &name[item->prefix_length], AUDIO_IMPORTER_STRLEN-1); - arg[AUDIO_IMPORTER_STRLEN-1] = 0; - item->function(this, arg, point, radius); - return true; // return true if this is an audio locator that was added to a list - } - - return false; // return false if the FBX importer should handle the locator itself -} - -// (3) turn corner definitions into spheres -void zoneNodeManager::generateSpheresForAllZones() -{ - ambientCornersList.generateSpheres(&ambientZoneList); - reverbCornersList.generateSpheres(&reverbZoneList); -} - -// (4) output ambient zones -// (5) output reverb zones -// (6) output audio nodes (props) -bool zoneNodeManager::outputAmbientZones() -{ - return true; -} - -bool zoneNodeManager::outputReverbZones() -{ - return true; -} - -bool zoneNodeManager::outputAudioNodes() -{ - return true; -} - -// END OF ImporterAudioLists.cpp diff --git a/KREngine/kraken/ImporterAudioLists.h b/KREngine/kraken/ImporterAudioLists.h deleted file mode 100644 index 60274e5..0000000 --- a/KREngine/kraken/ImporterAudioLists.h +++ /dev/null @@ -1,123 +0,0 @@ -// -// ImporterAudioLists.h -// - -#ifndef _IMPORTER_AUDIO_LISTS_H_ -#define _IMPORTER_AUDIO_LISTS_H_ - -#include "KRVector3.h" -#include "simpleList.h" - -enum { - AUDIO_IMPORTER_STRLEN = 128 -}; - -// -// (1) Nodes and Dummy Props - -// A locator point -// AN__ - -struct audioPoint : public simpleListObject { - KRVector3 point; - char name[AUDIO_IMPORTER_STRLEN]; // this could change to a std::string -}; - -// -// (2) Zone Locators - for ambient zones and reverb zones - -// A zone sphere object -// RZpoint_

_ locRadius and AZpoint__ locRadius - -struct zone : public simpleListObject { - KRVector3 point; - double radius; - unsigned long id; -}; - -// A zone corner object -// RZcorner_

_ and AZcorner__ - -struct zoneCorner : public simpleListObject { - KRVector3 point; - unsigned long id; -}; - -// -// A list of corners for a particular location - -struct zoneRoomCornersList : public simpleListObject { - unsigned long id; - simpleList corners; // the zoneCorner objects for a given id - - void addCorner(zoneCorner *c); - // add it into the list in presorted place/location_number order starting bottom left and going clockwise - void generateZones(simpleList *zonelist); - // create a set of spheres that fill in the space defined by the corners - // and add these spheres to the 'zonelist' -}; - -// -// A master list of lists of corners - -struct zoneAllCornersList : public simpleList { - void addCorner(zoneCorner *c); - // find or create a zoneRoomCornersList for the incoming id, then use that list's addCorner() method - - void generateSpheresFor(unsigned long id, simpleList *zonelist); - void generateSpheres(simpleList *zonelist); - // routines to generate circle points for the geometery of a given place + location_number - // .. and to place these cirlces into a given zone list -}; - -// A resource object -//

or - -struct zoneResource : public simpleListObject { - unsigned long id; - char resource_name[AUDIO_IMPORTER_STRLEN]; -}; - -struct zoneResourceList : public simpleList { - bool load(char *path1, char *path2 = NULL); - // all resources are loaded into the same list from either 1 or 2 input files - // we can either put all the reverb and ambient info in 1 file, or split it across 2 files -}; - -// -// (3) Zone and Node Manager - -struct zoneNodeManager { - zoneResourceList resources; - - simpleList ambientZoneList; // list of 'zone' objects - zoneAllCornersList ambientCornersList; - - simpleList reverbZoneList; // list of 'zone' objects - zoneAllCornersList reverbCornersList; - - simpleList audioNodesList; // a list of 'audioPoint' objects - - zoneNodeManager(); - virtual ~zoneNodeManager(); - - // (1) parse the resource files and create the resource list - bool loadResources(char *path1, char *path2=NULL); // passed through to resources.load() - - // (2) given a locator add it to the correct list - bool addLocatorToAList(char *name, KRVector3 point, double radius); - - // (3) turn corner definitions into spheres - void generateSpheresForAllZones(); - - // (4) output ambient zones - // (5) output reverb zones - // (6) output audio nodes (props) - virtual bool outputAmbientZones(); - virtual bool outputReverbZones(); - virtual bool outputAudioNodes(); -}; - -#endif - -// END OF ImporterAudioLists.h diff --git a/KREngine/kraken/KRCollider.h b/KREngine/kraken/KRCollider.h index 5c68693..cabf368 100644 --- a/KREngine/kraken/KRCollider.h +++ b/KREngine/kraken/KRCollider.h @@ -36,7 +36,6 @@ #define KRAKEN_COLLIDER_PHYSICS 1 #define KRAKEN_COLLIDER_AUDIO 2 -#define KRAKEN_COLLIDER_INTERACTABLE 16 // ADDED Dec 3, 2013 by Peter for collider_so layer mask type #include "KRMesh.h" #include "KRMat4.h" diff --git a/KREngine/kraken/KRResource+fbx.cpp b/KREngine/kraken/KRResource+fbx.cpp index 36ccf10..002a48a 100644 --- a/KREngine/kraken/KRResource+fbx.cpp +++ b/KREngine/kraken/KRResource+fbx.cpp @@ -141,15 +141,12 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path) FbxAnimCurve *curve = pFbxScene->GetSrcObject(i); printf(" Animation Curve %i of %i: %s\n", i+1, curve_count, curve->GetName()); KRAnimationCurve *new_curve = LoadAnimationCurve(context, curve); - - //***** curves 1, 2, and 3 are x, y, z translation .. the first point holds the key frame in centimeters - // POSSIBLE UPGRADE .. grab the key frame and output it as the start location to the kranimation file - + if(new_curve) { printf("Adding a curve\n"); context.getAnimationCurveManager()->addAnimationCurve(new_curve); } - } + } // ----====---- Import Materials ----====---- int material_count = pFbxScene->GetSrcObjectCount(); @@ -601,11 +598,12 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG FbxAnimStack* pAnimStack = pFbxScene->GetSrcObject(i); KRAnimation *pAnimation = parent_node->getContext().getAnimationManager()->getAnimation(pAnimStack->GetName()); if(pAnimation) { - int cLayers = pAnimStack->GetMemberCount(); + int cLayers = pAnimStack->GetMemberCount(); for(int iLayer=0; iLayer < cLayers; iLayer++) { FbxAnimLayer *pFbxAnimLayer = pAnimStack->GetMember(iLayer); // float weight = pFbxAnimLayer->Weight.Get(); KRAnimationLayer *pAnimationLayer = pAnimation->getLayer(pFbxAnimLayer->GetName()); + FbxAnimCurve *pAnimCurve = pNode->LclRotation.GetCurve(pFbxAnimLayer, FBXSDK_CURVENODE_COMPONENT_X); if(pAnimCurve) { KRAnimationAttribute *new_attribute = new KRAnimationAttribute(parent_node->getContext()); @@ -1023,7 +1021,6 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG switch(attribute_type) { case FbxNodeAttribute::eMesh: new_node = LoadMesh(parent_node, pFbxScene, pGeometryConverter, pNode); - // KRNode *LoadMesh parses the "collider names" and then alters the attributes (NFB HACK) break; case FbxNodeAttribute::eLight: new_node = LoadLight(parent_node, pNode); @@ -1470,7 +1467,6 @@ void LoadMesh(KRContext &context, FbxScene* pFbxScene, FbxGeometryConverter *pGe FbxVector2 uv; bool unmapped = false; if(pMesh->GetPolygonVertexUV(iPolygon, iVertex, setName, uv, unmapped)) { - // **** this is where the assert used to happen if(!unmapped) { new_uva = KRVector2(uv[0], uv[1]); } @@ -1563,22 +1559,29 @@ KRNode *LoadMesh(KRNode *parent_node, FbxScene* pFbxScene, FbxGeometryConverter std::string light_map = pNode->GetName(); light_map.append("_lightmap"); -//FINDME - THIS IS WHERE THE collider in house names are parsed and handled .. and then the collider_ names are done -// in CircaViewController.mm postLoadSetup .. with the addition of KRAKEN_COLLIDER_INTERACTABLE the postLoadSetup is redundant. -// - // FINDME, HACK - Until we have a GUI, we're using prefixes to select correct object type const char *node_name = pNode->GetName(); if(strncmp(node_name, "physics_collider_", strlen("physics_collider_")) == 0) { return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_PHYSICS, 0.0f); } else if(strncmp(node_name, "audio_collider_", strlen("audio_collider_")) == 0) { return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_AUDIO, 1.0f); - } else if(0 == strncmp(node_name, "collider_so_", strlen("collider_so_"))) { - // ADDED Dec 3, 2013 by Peter to handle the scene object colliders that are layerMask 'Interactable' (16) - return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_INTERACTABLE, 1.0f); - } else if(strncmp(node_name, "collider_", strlen("collider_")) == 0) { + } else if(strncmp(node_name, "collider_", 9) == 0) { // 9 == strlen("collider_") + // Colliders can have a prefix of collider_##_, where ## indicates the layer mask + // Colliders with a prefix of only collider_ will have a default layer mask of KRAKEN_COLLIDER_PHYSICS | KRAKEN_COLLIDER_AUDIO - return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), KRAKEN_COLLIDER_PHYSICS | KRAKEN_COLLIDER_AUDIO, 1.0f); + // Scan through the characters of the name until we no longer see digit characters (or see a '\0' indicating the end of the string) + unsigned int layer = 0; + char *szNodeName = node_name.c_str() + 9; // 9 == strlen("collider_") + char *source_char = szNodeName; + while(*source_char >= '0' && *source_char <= '9') { + layer = layer * 10 + (*source_char++ - '0'); + } + + if(layer == 0) { + // No layer mask number was found, use the default + layer = KRAKEN_COLLIDER_PHYSICS | KRAKEN_COLLIDER_AUDIO; + } + return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), layer, 1.0f); } else { return new KRModel(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), light_map, 0.0f, true, false); } @@ -1605,90 +1608,6 @@ KRNode *LoadSkeleton(KRNode *parent_node, FbxScene* pFbxScene, FbxNode* pNode) { KRNode *LoadLocator(KRNode *parent_node, FbxScene* pFbxScene, FbxNode* pNode) { std::string name = GetFbxObjectName(pNode); -//**** INTERUPT THE NODE STUFF IN HERE -// we can parse the name, look for our special naming conventions, and then route stuff -// either through to the normal locator block within the scene, or we can dump it out -// to another destination .. a script file, an xml file, whatever we need. -//**** - - //**** HACK A BIT TO FIND OUT HOW IT WORKS - const char *node_name = pNode->GetName(); - FbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSourcePivot); - KRVector3 node_translation = KRVector3(local_translation[0], local_translation[1], local_translation[2]); - -// if(strncmp(node_name, "physics_collider_", strlen("physics_collider_")) == 0) { -// // example hard coded compare -// } - // - // Place all the zone markers at listening (head) height - // - // is a number with the letter 'H' (hotel) or 'A' (alley) at the end of it - // - // KRReverbZone .. see CircaActorStep_CreateReverbZone::execute - // RZcorner_ .. with no meta data - // RZpoint_ .. with meta data locRadius - // - // KRAmbientZone .. see CircaActorStep_CreateAmbientZone::execute - // AZcorner_ .. all ambient sounds will be numbered somewhere in a master sound list file - // AZpoint_ .. with meta data locRadius - // - // KRModel .. see CircaActorStep_CreateDummyProp::execute - // AN_ .. an audio prop location that can be referenced by name in a trigger script - // - // QUESTION - should we do AN__ - // and then trigger the sound by activating the prop point (i.e. the sound file is already associated with the point) - // but the dummy prop doesn't have anywhere to store the sound file name - // - - // This is how it's done in the actor files .. - // - // create_ambient_zone entrance_ambient_zone entrance 99.0728 2.9885 -35.3381 10.0 10.0 10.0 0.25 p1_s1.0_1_traffic_general_loop 1.0 - // create_reverb_zone telegraph_office_reverb_zone telegraph_office -53.3345 3.58721 58.2977 20.0 20.0 20.0 0.25 reverb_telegraph 1.0 - // - // create_prop telegraph_radio dummyprop 94.371559 4.400661 31.469673 0.05 - // - creates a reference point that the radio sound is 'located at' later in the script - // create_node mitchell_phone 22.7842 18.7481 9.1446 - // - - // TO BE ADDED - // - // bool GetDoubleProperty(const char **match_list, double &value); - // pass in a c-string array of case insensitive property names that are all treated as identical - // return true if the property is found - // i.e. if(GetDoubleProperty({"locradius","radius",NULL}, value)) .. - // - - // TO BE ADDED - // - // bool ParseLocator(FbxNode* pNode); - // returns true is we should add the locator to the scene and false otherwise - // parses the locator and either returns it to be added to the scene or sends it somewhere else - // somewhere else would be: ambient_zone, reverb_zone, dummy_prop - // - - FbxProperty myprop = pNode->FindProperty("locRadius", true); // (name, is_case_sensitive) - if (myprop.IsValid()) { - printf("locRadius found!\n"); - FbxDataType pdt = myprop.GetPropertyDataType(); - EFbxType ptype= pdt.GetType(); - if (eFbxDouble == ptype) { - double radius = myprop.Get(); - printf("The radius is %3.4f\n", radius); - } - } - - // FbxProperty p = GetFirstProperty(); - // p = GetNextProperty(p); - // if (p.IsValid()) .. - // FbxDataType pdt = p.GetPropertyDataType(); - // EFbxType = pdt.GetType(); // this is an enumerated type - // FbxString pname = p.GetName(); - // const char * s = p.GetNameAsCStr(); // owned by the fbx library - - - - //**** END OF HACK - KRLocator *new_locator = new KRLocator(parent_node->getScene(), name.c_str()); //static bool GetBindPoseContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray& pIndex); diff --git a/KREngine/kraken/simpleList.cpp b/KREngine/kraken/simpleList.cpp deleted file mode 100644 index b7c8ee9..0000000 --- a/KREngine/kraken/simpleList.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// -// simpleList.cpp -// - -#include "simpleList.h" - -simpleListObject::simpleListObject() { next = previous = NULL; } -simpleListObject::~simpleListObject() { } - -simpleList::simpleList() { - first = last = NULL; - nelements = 0; -}; - -simpleList::~simpleList() { while((first)) remove(first); } - -void simpleList::add(simpleListObject *elem, simpleListObject *after) { - if (NULL == elem) return; - if (NULL == first) { - first = last = elem; - elem->next = elem->previous = NULL; - } - else { - if (NULL == after) { after = last; } - if (last == after) { - elem->next = NULL; - elem->previous = last; - last->next = elem; - last = elem; - } - else { - elem->previous = after; - elem->next = after->next; - after->next->previous = elem; - after->next = elem; - } - } - nelements++; -} - -void simpleList::insert(simpleListObject *elem, simpleListObject *before) { - if (NULL == elem) return; - if (NULL == first) { - first = last = elem; - elem->next = elem->previous = NULL; - } - else { - if (NULL == before) { before = first; } - if (first == before) { - elem->previous = NULL; - elem->next = first; - first->previous = elem; - first = elem; - } - else { - elem->previous = before->previous; - elem->next = before; - before->previous->next = elem; - before->previous = elem; - } - } - nelements++; -} - -void simpleList::remove(simpleListObject *elem) { - if (0 == nelements) return; - if (NULL == elem) return; - if (NULL != elem->previous) elem->previous->next = elem->next; - if (NULL != elem->next) elem->next->previous = elem->previous; - if (elem == last) last = elem->previous; - if (elem == first) first = elem->next; - elem->previous = elem->next = NULL; - nelements--; -} - -simpleListObject *simpleList::findByIndex(unsigned long index) { - simpleListObject *result = NULL; - if (index < nelements) { - simpleListObject *current = first; - for (unsigned long i = 0; (i < index) && (NULL != current); i++) - current = current->next; - result = current; - } - return result; -} - -// END OF simpleList.cpp diff --git a/KREngine/kraken/simpleList.h b/KREngine/kraken/simpleList.h deleted file mode 100644 index 91081f6..0000000 --- a/KREngine/kraken/simpleList.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// simpleList.h -// - -#ifndef _SIMPLE_LIST_OBJECTS_H_ -#define _SIMPLE_LIST_OBJECTS_H_ - -#include // include for pre c++11 defines - -struct simpleListObject { - simpleListObject *next; - simpleListObject *previous; - - simpleListObject(); - ~simpleListObject(); -}; // end of struct simpleListObject - -struct simpleList { - simpleListObject *first; - simpleListObject *last; - unsigned long nelements; - - simpleList(); - ~simpleList(); - - void add(simpleListObject *elem, simpleListObject *after=NULL); - void insert(simpleListObject *elem, simpleListObject *before=NULL); - void remove(simpleListObject *elem); - simpleListObject *findByIndex(unsigned long index); -}; // end of struct simpleList - -#endif - -// END OF simpleList.h - \ No newline at end of file