- I have replaced the lines inserted in to KRResource+Fbx that look for “collider_so_” with logic to look for “collider_##_”. This means that Jonny will need to name the flare height colliders with a prefix of “collider_16_” in the Circa 1948 project.
- The code block starting with “INTERRUPT THE NODE STUFF IN HERE” has been moved to KRImport where it should occur. I have added an example in there on - Removed the comments, “***** 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”, as this is incorrect and misleading. You must never depend on the order of the curves in the FBX file. The exporting of the first point in the animation curve should be done in KRImport, after Kraken has already resolved the animation layers and attribute assignments using proper metadata in the fbx file. You can do this using the existing Kraken API rather than modifying Kraken itself. In addition, we can’t make any assumptions based on the first keyframe time matching the animation start time. The actual animation start time is imported by Kraken using the FBX fields that explicitly specify it. The reason we read animation start and end times from a text file is to split the animation into multiple animations from a single fbx file. KRImport can already export a single animation from an fbx file automatically simply by not specifying an animation split file. - Removed comment, “// **** this is where the assert used to happen”. This comment adds no value and is confusing to other Kraken users, as the assert does not happen any more ;-) - Removed comment, “// KRNode *LoadMesh parses the "collider names" and then alters the attributes (NFB HACK)”. I have refactored this code so this is no longer a hack. --HG-- branch : nfb
This commit is contained in:
@@ -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 = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
104A335D1672D31C001C8BA6 /* KRCollider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRCollider.h; sourceTree = "<group>"; 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 = "<group>"; };
|
||||
500CB1EC185115280097F31B /* simpleList.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = simpleList.h; sourceTree = "<group>"; };
|
||||
50B6C52F185111C600047FF8 /* ImporterAudioLists.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = ImporterAudioLists.cpp; sourceTree = "<group>"; };
|
||||
50B6C531185111C600047FF8 /* simpleList.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = simpleList.cpp; sourceTree = "<group>"; };
|
||||
E4030E4B160A3CF000592648 /* KRStockGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRStockGeometry.h; sourceTree = "<group>"; };
|
||||
E40BA45215EFF79500D7C3DD /* KRAABB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRAABB.cpp; sourceTree = "<group>"; };
|
||||
E40BA45315EFF79500D7C3DD /* KRAABB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRAABB.h; sourceTree = "<group>"; };
|
||||
@@ -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 = "<group>";
|
||||
};
|
||||
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 */,
|
||||
|
||||
@@ -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
|
||||
// <n> will convert to <n>
|
||||
// <n>H will convert to <n> << 8
|
||||
// <n>A will convert to <n> << 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_<node_name>_<unique> is an audio node
|
||||
// AZpoint_<n>_<unique> is an audio zone point with a radius
|
||||
// RZpoint_<n><p>_<unique> is a reverb zone point with a radius
|
||||
// AZcorner_<n>_<order> is a corner for an ambient zone
|
||||
// RZcorner_<n><p>_<order> 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
|
||||
@@ -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_<node_name>_<unique>
|
||||
|
||||
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_<n><p>_<unique> locRadius and AZpoint_<n>_<unique> locRadius
|
||||
|
||||
struct zone : public simpleListObject {
|
||||
KRVector3 point;
|
||||
double radius;
|
||||
unsigned long id;
|
||||
};
|
||||
|
||||
// A zone corner object
|
||||
// RZcorner_<n><p>_<order_clockwise> and AZcorner_<n>_<order_clockwise>
|
||||
|
||||
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
|
||||
// <n><p> <resource file name> or <n> <resource file name>
|
||||
|
||||
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
|
||||
@@ -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"
|
||||
|
||||
@@ -142,14 +142,11 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path)
|
||||
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<FbxSurfaceMaterial>();
|
||||
@@ -601,11 +598,12 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG
|
||||
FbxAnimStack* pAnimStack = pFbxScene->GetSrcObject<FbxAnimStack>(i);
|
||||
KRAnimation *pAnimation = parent_node->getContext().getAnimationManager()->getAnimation(pAnimStack->GetName());
|
||||
if(pAnimation) {
|
||||
int cLayers = pAnimStack->GetMemberCount<FbxAnimLayer>();
|
||||
int cLayers = pAnimStack->GetMemberCount<FbxAnimLayer>();
|
||||
for(int iLayer=0; iLayer < cLayers; iLayer++) {
|
||||
FbxAnimLayer *pFbxAnimLayer = pAnimStack->GetMember<FbxAnimLayer>(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_<ack> 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
|
||||
//
|
||||
// <room#> is a number with the letter 'H' (hotel) or 'A' (alley) at the end of it
|
||||
//
|
||||
// KRReverbZone .. see CircaActorStep_CreateReverbZone::execute
|
||||
// RZcorner_<room#> .. with no meta data
|
||||
// RZpoint_<room#> .. with meta data locRadius
|
||||
//
|
||||
// KRAmbientZone .. see CircaActorStep_CreateAmbientZone::execute
|
||||
// AZcorner_<sound#> .. all ambient sounds will be numbered somewhere in a master sound list file
|
||||
// AZpoint_<sound#> .. with meta data locRadius
|
||||
//
|
||||
// KRModel .. see CircaActorStep_CreateDummyProp::execute
|
||||
// AN_<prop point name> .. an audio prop location that can be referenced by name in a trigger script
|
||||
//
|
||||
// QUESTION - should we do AN_<sound #>_<prop point name>
|
||||
// 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<FbxDouble>();
|
||||
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<int>& pIndex);
|
||||
|
||||
@@ -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
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// simpleList.h
|
||||
//
|
||||
|
||||
#ifndef _SIMPLE_LIST_OBJECTS_H_
|
||||
#define _SIMPLE_LIST_OBJECTS_H_
|
||||
|
||||
#include <cstddef> // 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
|
||||
|
||||
Reference in New Issue
Block a user