| 114 | } |
| 115 | |
| 116 | void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndTime, F32& minFrameTime) |
| 117 | { |
| 118 | const char* sRGBANames[] = { ".R", ".G", ".B", ".A", "" }; |
| 119 | const char* sXYZNames[] = { ".X", ".Y", ".Z", "" }; |
| 120 | const char* sXYZANames[] = { ".X", ".Y", ".Z", ".ANGLE" }; |
| 121 | const char* sLOOKATNames[] = { ".POSITIONX", ".POSITIONY", ".POSITIONZ", ".TARGETX", ".TARGETY", ".TARGETZ", ".UPX", ".UPY", ".UPZ", "" }; |
| 122 | const char* sSKEWNames[] = { ".ROTATEX", ".ROTATEY", ".ROTATEZ", ".AROUNDX", ".AROUNDY", ".AROUNDZ", ".ANGLE", "" }; |
| 123 | const char* sNullNames[] = { "" }; |
| 124 | |
| 125 | for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) { |
| 126 | |
| 127 | // Get the animation elements: <channel>, <sampler> |
| 128 | domChannel* channel = anim->getChannel_array()[iChannel]; |
| 129 | domSampler* sampler = daeSafeCast<domSampler>(channel->getSource().getElement()); |
| 130 | if (!sampler) |
| 131 | continue; |
| 132 | |
| 133 | // Find the animation channel target |
| 134 | daeSIDResolver resolver(channel, channel->getTarget()); |
| 135 | daeElement* target = resolver.getElement(); |
| 136 | if (!target) { |
| 137 | daeErrorHandler::get()->handleWarning(avar("Failed to resolve animation " |
| 138 | "target: %s", channel->getTarget())); |
| 139 | continue; |
| 140 | } |
| 141 | /* |
| 142 | // If the target is a <source>, point it at the array instead |
| 143 | // @todo:Only support targeting float arrays for now... |
| 144 | if (target->getElementType() == COLLADA_TYPE::SOURCE) |
| 145 | { |
| 146 | domSource* source = daeSafeCast<domSource>(target); |
| 147 | if (source->getFloat_array()) |
| 148 | target = source->getFloat_array(); |
| 149 | } |
| 150 | */ |
| 151 | // Get the target's animation channels (create them if not already) |
| 152 | if (!AnimData::getAnimChannels(target)) { |
| 153 | animations.push_back(new AnimChannels(target)); |
| 154 | } |
| 155 | AnimChannels* targetChannels = AnimData::getAnimChannels(target); |
| 156 | |
| 157 | // Add a new animation channel to the target |
| 158 | targetChannels->push_back(new AnimData()); |
| 159 | channel->setUserData(targetChannels->last()); |
| 160 | AnimData& data = *targetChannels->last(); |
| 161 | |
| 162 | for (S32 iInput = 0; iInput < sampler->getInput_array().getCount(); iInput++) { |
| 163 | |
| 164 | const domInputLocal* input = sampler->getInput_array()[iInput]; |
| 165 | const domSource* source = daeSafeCast<domSource>(input->getSource().getElement()); |
| 166 | if (!source) |
| 167 | continue; |
| 168 | |
| 169 | // @todo:don't care about the input param names for now. Could |
| 170 | // validate against the target type.... |
| 171 | if (dStrEqual(input->getSemantic(), "INPUT")) { |
| 172 | data.input.initFromSource(source); |
| 173 | // Adjust the maximum sequence end time |
nothing calls this directly
no test coverage detected