Refactor: Expand tabs to 4 spaces
This commit is contained in:
@@ -55,85 +55,85 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
namespace FBX {
|
||||
|
||||
using namespace Util;
|
||||
using namespace Util;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name)
|
||||
: Object(id,element,name)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
|
||||
const Element* const ShadingModel = sc["ShadingModel"];
|
||||
const Element* const MultiLayer = sc["MultiLayer"];
|
||||
const Element* const ShadingModel = sc["ShadingModel"];
|
||||
const Element* const MultiLayer = sc["MultiLayer"];
|
||||
|
||||
if(MultiLayer) {
|
||||
multilayer = !!ParseTokenAsInt(GetRequiredToken(*MultiLayer,0));
|
||||
}
|
||||
if(MultiLayer) {
|
||||
multilayer = !!ParseTokenAsInt(GetRequiredToken(*MultiLayer,0));
|
||||
}
|
||||
|
||||
if(ShadingModel) {
|
||||
shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0));
|
||||
}
|
||||
else {
|
||||
DOMWarning("shading mode not specified, assuming phong",&element);
|
||||
shading = "phong";
|
||||
}
|
||||
if(ShadingModel) {
|
||||
shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0));
|
||||
}
|
||||
else {
|
||||
DOMWarning("shading mode not specified, assuming phong",&element);
|
||||
shading = "phong";
|
||||
}
|
||||
|
||||
std::string templateName;
|
||||
std::string templateName;
|
||||
|
||||
const char* const sh = shading.c_str();
|
||||
if(!strcmp(sh,"phong")) {
|
||||
templateName = "Material.FbxSurfacePhong";
|
||||
}
|
||||
else if(!strcmp(sh,"lambert")) {
|
||||
templateName = "Material.FbxSurfaceLambert";
|
||||
}
|
||||
else {
|
||||
DOMWarning("shading mode not recognized: " + shading,&element);
|
||||
}
|
||||
const char* const sh = shading.c_str();
|
||||
if(!strcmp(sh,"phong")) {
|
||||
templateName = "Material.FbxSurfacePhong";
|
||||
}
|
||||
else if(!strcmp(sh,"lambert")) {
|
||||
templateName = "Material.FbxSurfaceLambert";
|
||||
}
|
||||
else {
|
||||
DOMWarning("shading mode not recognized: " + shading,&element);
|
||||
}
|
||||
|
||||
props = GetPropertyTable(doc,templateName,element,sc);
|
||||
props = GetPropertyTable(doc,templateName,element,sc);
|
||||
|
||||
// resolve texture links
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
// resolve texture links
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// texture link to properties, not objects
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
// texture link to properties, not objects
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const Texture* const tex = dynamic_cast<const Texture*>(ob);
|
||||
if(!tex) {
|
||||
const LayeredTexture* const layeredTexture = dynamic_cast<const LayeredTexture*>(ob);
|
||||
if(!layeredTexture) {
|
||||
DOMWarning("source object for texture link is not a texture or layered texture, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const std::string& prop = con->PropertyName();
|
||||
if (layeredTextures.find(prop) != layeredTextures.end()) {
|
||||
DOMWarning("duplicate layered texture link: " + prop,&element);
|
||||
}
|
||||
const Texture* const tex = dynamic_cast<const Texture*>(ob);
|
||||
if(!tex) {
|
||||
const LayeredTexture* const layeredTexture = dynamic_cast<const LayeredTexture*>(ob);
|
||||
if(!layeredTexture) {
|
||||
DOMWarning("source object for texture link is not a texture or layered texture, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const std::string& prop = con->PropertyName();
|
||||
if (layeredTextures.find(prop) != layeredTextures.end()) {
|
||||
DOMWarning("duplicate layered texture link: " + prop,&element);
|
||||
}
|
||||
|
||||
layeredTextures[prop] = layeredTexture;
|
||||
((LayeredTexture*)layeredTexture)->fillTexture(doc);
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string& prop = con->PropertyName();
|
||||
if (textures.find(prop) != textures.end()) {
|
||||
DOMWarning("duplicate texture link: " + prop,&element);
|
||||
}
|
||||
layeredTextures[prop] = layeredTexture;
|
||||
((LayeredTexture*)layeredTexture)->fillTexture(doc);
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string& prop = con->PropertyName();
|
||||
if (textures.find(prop) != textures.end()) {
|
||||
DOMWarning("duplicate texture link: " + prop,&element);
|
||||
}
|
||||
|
||||
textures[prop] = tex;
|
||||
}
|
||||
textures[prop] = tex;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,57 +148,57 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
|
||||
: Object(id,element,name)
|
||||
, uvScaling(1.0f,1.0f)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
|
||||
const Element* const Type = sc["Type"];
|
||||
const Element* const FileName = sc["FileName"];
|
||||
const Element* const RelativeFilename = sc["RelativeFilename"];
|
||||
const Element* const ModelUVTranslation = sc["ModelUVTranslation"];
|
||||
const Element* const ModelUVScaling = sc["ModelUVScaling"];
|
||||
const Element* const Texture_Alpha_Source = sc["Texture_Alpha_Source"];
|
||||
const Element* const Cropping = sc["Cropping"];
|
||||
const Element* const Type = sc["Type"];
|
||||
const Element* const FileName = sc["FileName"];
|
||||
const Element* const RelativeFilename = sc["RelativeFilename"];
|
||||
const Element* const ModelUVTranslation = sc["ModelUVTranslation"];
|
||||
const Element* const ModelUVScaling = sc["ModelUVScaling"];
|
||||
const Element* const Texture_Alpha_Source = sc["Texture_Alpha_Source"];
|
||||
const Element* const Cropping = sc["Cropping"];
|
||||
|
||||
if(Type) {
|
||||
type = ParseTokenAsString(GetRequiredToken(*Type,0));
|
||||
}
|
||||
if(Type) {
|
||||
type = ParseTokenAsString(GetRequiredToken(*Type,0));
|
||||
}
|
||||
|
||||
if(FileName) {
|
||||
fileName = ParseTokenAsString(GetRequiredToken(*FileName,0));
|
||||
}
|
||||
if(FileName) {
|
||||
fileName = ParseTokenAsString(GetRequiredToken(*FileName,0));
|
||||
}
|
||||
|
||||
if(RelativeFilename) {
|
||||
relativeFileName = ParseTokenAsString(GetRequiredToken(*RelativeFilename,0));
|
||||
}
|
||||
if(RelativeFilename) {
|
||||
relativeFileName = ParseTokenAsString(GetRequiredToken(*RelativeFilename,0));
|
||||
}
|
||||
|
||||
if(ModelUVTranslation) {
|
||||
uvTrans = aiVector2D(ParseTokenAsFloat(GetRequiredToken(*ModelUVTranslation,0)),
|
||||
ParseTokenAsFloat(GetRequiredToken(*ModelUVTranslation,1))
|
||||
);
|
||||
}
|
||||
if(ModelUVTranslation) {
|
||||
uvTrans = aiVector2D(ParseTokenAsFloat(GetRequiredToken(*ModelUVTranslation,0)),
|
||||
ParseTokenAsFloat(GetRequiredToken(*ModelUVTranslation,1))
|
||||
);
|
||||
}
|
||||
|
||||
if(ModelUVScaling) {
|
||||
uvScaling = aiVector2D(ParseTokenAsFloat(GetRequiredToken(*ModelUVScaling,0)),
|
||||
ParseTokenAsFloat(GetRequiredToken(*ModelUVScaling,1))
|
||||
);
|
||||
}
|
||||
if(ModelUVScaling) {
|
||||
uvScaling = aiVector2D(ParseTokenAsFloat(GetRequiredToken(*ModelUVScaling,0)),
|
||||
ParseTokenAsFloat(GetRequiredToken(*ModelUVScaling,1))
|
||||
);
|
||||
}
|
||||
|
||||
if(Cropping) {
|
||||
crop[0] = ParseTokenAsInt(GetRequiredToken(*Cropping,0));
|
||||
crop[1] = ParseTokenAsInt(GetRequiredToken(*Cropping,1));
|
||||
crop[2] = ParseTokenAsInt(GetRequiredToken(*Cropping,2));
|
||||
crop[3] = ParseTokenAsInt(GetRequiredToken(*Cropping,3));
|
||||
}
|
||||
else {
|
||||
// vc8 doesn't support the crop() syntax in initialization lists
|
||||
// (and vc9 WARNS about the new (i.e. compliant) behaviour).
|
||||
crop[0] = crop[1] = crop[2] = crop[3] = 0;
|
||||
}
|
||||
if(Cropping) {
|
||||
crop[0] = ParseTokenAsInt(GetRequiredToken(*Cropping,0));
|
||||
crop[1] = ParseTokenAsInt(GetRequiredToken(*Cropping,1));
|
||||
crop[2] = ParseTokenAsInt(GetRequiredToken(*Cropping,2));
|
||||
crop[3] = ParseTokenAsInt(GetRequiredToken(*Cropping,3));
|
||||
}
|
||||
else {
|
||||
// vc8 doesn't support the crop() syntax in initialization lists
|
||||
// (and vc9 WARNS about the new (i.e. compliant) behaviour).
|
||||
crop[0] = crop[1] = crop[2] = crop[3] = 0;
|
||||
}
|
||||
|
||||
if(Texture_Alpha_Source) {
|
||||
alphaSource = ParseTokenAsString(GetRequiredToken(*Texture_Alpha_Source,0));
|
||||
}
|
||||
if(Texture_Alpha_Source) {
|
||||
alphaSource = ParseTokenAsString(GetRequiredToken(*Texture_Alpha_Source,0));
|
||||
}
|
||||
|
||||
props = GetPropertyTable(doc,"Texture.FbxFileTexture",element,sc);
|
||||
props = GetPropertyTable(doc,"Texture.FbxFileTexture",element,sc);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,20 +213,20 @@ LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Docume
|
||||
,blendMode(BlendMode_Modulate)
|
||||
,alpha(1)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
|
||||
const Element* const BlendModes = sc["BlendModes"];
|
||||
const Element* const Alphas = sc["Alphas"];
|
||||
const Element* const BlendModes = sc["BlendModes"];
|
||||
const Element* const Alphas = sc["Alphas"];
|
||||
|
||||
|
||||
if(BlendModes!=0)
|
||||
{
|
||||
blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(*BlendModes,0));
|
||||
}
|
||||
if(Alphas!=0)
|
||||
{
|
||||
alpha = ParseTokenAsFloat(GetRequiredToken(*Alphas,0));
|
||||
}
|
||||
if(BlendModes!=0)
|
||||
{
|
||||
blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(*BlendModes,0));
|
||||
}
|
||||
if(Alphas!=0)
|
||||
{
|
||||
alpha = ParseTokenAsFloat(GetRequiredToken(*Alphas,0));
|
||||
}
|
||||
}
|
||||
|
||||
LayeredTexture::~LayeredTexture()
|
||||
@@ -236,21 +236,21 @@ LayeredTexture::~LayeredTexture()
|
||||
|
||||
void LayeredTexture::fillTexture(const Document& doc)
|
||||
{
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||
for(size_t i = 0; i < conns.size();++i)
|
||||
{
|
||||
const Connection* con = conns.at(i);
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||
for(size_t i = 0; i < conns.size();++i)
|
||||
{
|
||||
const Connection* con = conns.at(i);
|
||||
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const Texture* const tex = dynamic_cast<const Texture*>(ob);
|
||||
const Texture* const tex = dynamic_cast<const Texture*>(ob);
|
||||
|
||||
texture = tex;
|
||||
}
|
||||
texture = tex;
|
||||
}
|
||||
}
|
||||
|
||||
} //!FBX
|
||||
|
||||
Reference in New Issue
Block a user