-
Notifications
You must be signed in to change notification settings - Fork 9
Collada a1.0 #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: add-collada
Are you sure you want to change the base?
Collada a1.0 #32
Conversation
| DIRECTIONAL, | ||
| POINT, | ||
| SPOT, | ||
| UNKOWN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: UNKNOWN
|
|
||
| bool InvertY(CanvasTex::Image image); | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove new lines
| size_t s = bufferSize < m_size ? bufferSize : m_size; | ||
| return Read(outputBuffer, s); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove extra new line
| std::vector<float> inputs; | ||
| std::vector<float> outputs; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove extra new line
| }; | ||
| } | ||
| } | ||
| #pragma once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this extra pragma once necessary?
| m_light = light; | ||
| return *this; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove extra new line
| * * | ||
| ********************************************************/ | ||
| #pragma once | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove extra new line
| class Skeleton; | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove extra new line
| //COLLADAFW::ColorOrTexture transparent = effectCommon->getTransparent(); | ||
| //if (transparent.isTexture()) { | ||
| // std::cerr << "WARNING: Effect " << effect->getOriginalId() << | ||
| // " contains a transparent texture that will be omitted from" << | ||
| // " the converted model." << std::endl; | ||
| //} | ||
| //else if (transparent.isColor()) { | ||
| // float* diffuse = material->values->diffuse; | ||
| // if (diffuse == NULL) { | ||
| // diffuse = new float[4]; | ||
| // diffuse[0] = 1.0; | ||
| // diffuse[1] = 1.0; | ||
| // diffuse[2] = 1.0; | ||
| // diffuse[3] = 1.0; | ||
| // material->values->diffuse = diffuse; | ||
| // } | ||
| // float* transparentValues = new float[4]; | ||
| // packColladaColor(transparent.getColor(), transparentValues); | ||
| // auto opaqueMode = effectCommon->getOpaqueMode(); | ||
| // bool alwaysUseAlpha = (opaqueMode == COLLADAFW::EffectCommon::OpaqueMode::A_ONE) || | ||
| // (opaqueMode == COLLADAFW::EffectCommon::OpaqueMode::A_ZERO); | ||
| // bool oneMinus = (opaqueMode == COLLADAFW::EffectCommon::OpaqueMode::RGB_ZERO) || | ||
| // (opaqueMode == COLLADAFW::EffectCommon::OpaqueMode::A_ZERO); | ||
| // for (size_t i = 0; i < 4; i++) { | ||
| // auto transparentValue = transparentValues[alwaysUseAlpha ? 3 : i]; | ||
|
|
||
| // if (!alwaysUseAlpha && i == 3) { //RGB_ZERO or RGB_ONE - use luminance for alpha | ||
| // transparentValue = (transparentValues[0] * 0.212671) + | ||
| // (transparentValues[1] * 0.715160) + | ||
| // (transparentValues[2] * 0.072169); | ||
| // } | ||
|
|
||
| // diffuse[i] *= (oneMinus ? (1.0 - transparentValue) : transparentValue); | ||
| // } | ||
| // if (diffuse[3] < 1.0) { | ||
| // material->transparent = true; | ||
| // } | ||
| // delete transparentValues; | ||
| //} | ||
|
|
||
| //COLLADAFW::FloatOrParam shininess = effectCommon->getShininess(); | ||
| //if (shininess.getType() == COLLADAFW::FloatOrParam::FLOAT) { | ||
| // float shininessValue = shininess.getFloatValue(); | ||
| // if (shininessValue >= 0) { | ||
| // material->values->shininess = new float[1]; | ||
| // material->values->shininess[0] = shininessValue; | ||
| // } | ||
| //} | ||
|
|
||
| //COLLADAFW::FloatOrParam transparency = effectCommon->getTransparency(); | ||
| //if (transparency.getType() == COLLADAFW::FloatOrParam::FLOAT) { | ||
| // float transparencyValue = transparency.getFloatValue(); | ||
| // if (_options->invertTransparency) { | ||
| // transparencyValue = 1.0 - transparencyValue; | ||
| // } | ||
| // if (transparencyValue < 1.0) { | ||
| // material->values->transparency = new float[1]; | ||
| // material->values->transparency[0] = transparencyValue; | ||
| // material->transparent = true; | ||
| // } | ||
| //} | ||
|
|
||
| //auto bumpTextureIt = _extrasHandler->bumpTextures.find(effect->getUniqueId()); | ||
| //if (bumpTextureIt != _extrasHandler->bumpTextures.end()) { | ||
| // material->values->bumpTexture = fromColladaTexture(effectCommon, (*bumpTextureIt).second->samplerId); | ||
| //} | ||
|
|
||
| //bool doubleSided = _extrasHandler->doubleSided.find(effect->getUniqueId()) != _extrasHandler->doubleSided.end(); | ||
| //if (doubleSided) { | ||
| // material->doubleSided = true; | ||
| //} | ||
|
|
||
| //_effectTextureMapping[effectId] = textureMapping; | ||
| //_effectInstances[effectId] = material; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there's a specific reason to keep it in, it might be a good idea to remove this commented code.
| //std::shared_ptr<Mesh> DAENodeBuilder::BuildSkin(std::shared_ptr<DAESkinController> controller) { | ||
| // | ||
| // int n0 = controller->data->getNumberOfComponents(); | ||
| // int n = n0; | ||
| // /// Asset3D do NOT support more than 4 joints/weights per vertex | ||
| // if (n > MAX_JOINT_INFLUENCES) { | ||
| // TRACE_WARN(DAENodeBuilder, "Asset 3D currently accept ONLY %x joints influences - given %x joints - extra items will be ignored.", MAX_JOINT_INFLUENCES, n); | ||
| // n = MAX_JOINT_INFLUENCES; | ||
| // } | ||
| // | ||
| // controller->meshBuilder->Save(); | ||
| // | ||
| // /// assign weight and joint to underlying primitives | ||
| // for (auto geom : controller->meshBuilder->GetGeometries()) { | ||
| // | ||
| // /// get an ordered list of used vertex (POSITION semantic) inside this primitive | ||
| // std::vector<uint32_t> mapping = geom->GetOriginalIndices(); | ||
| // std::vector<uint32_t> indices = geom->GetIndices(); | ||
| // | ||
| // /** | ||
| // * assign weigth & joints. We gona flatten array[][n]. | ||
| // */ | ||
| // size_t size = controller->data->weights.size() * n; | ||
| // std::vector<float> weights; | ||
| // weights.reserve(size); | ||
| // std::vector<uint32_t> joints; | ||
| // joints.reserve(size); | ||
| // | ||
| // for (int i = 0; i != mapping.size(); i++) { | ||
| // | ||
| // uint32_t originalIndex = mapping[i]; | ||
| // uint32_t index = indices[i]; | ||
| // float* weight = controller->data->weights[originalIndex]; | ||
| // uint32_t* joint = controller->data->jointIndices[originalIndex]; | ||
| // uint32_t offset = index * n0; // we seek offset using original number of component | ||
| // | ||
| // /// note : keeping in mind as indices are describnig faces, this should be repeated several time at the same offset | ||
| // joints.insert(joints.begin() + offset, joint, joint + n); | ||
| // weights.insert(weights.begin() + offset, weight, weight + n); | ||
| // } | ||
| // | ||
| // geom->WithJoints(std::move(joints), std::move(weights)); | ||
| // } | ||
| // | ||
| // std::shared_ptr<Mesh> mesh = controller->meshBuilder->Build(); | ||
| // controller->meshBuilder->Restore(); | ||
| // | ||
| // return mesh; | ||
| //} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there's a specific reason to keep it in, it might be a good idea to remove this commented code.
Initial COLLADA Pull Resquest