Skip to content

Commit 780efea

Browse files
flarivenem0
authored andcommitted
Add opacity and getOpacity() as double
1 parent 671fa36 commit 780efea

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ofbx.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,7 @@ struct MaterialImpl : Material
14001400
double getAmbientFactor() const override { return ambient_factor; };
14011401
double getBumpFactor() const override { return bump_factor; };
14021402
double getEmissiveFactor() const override { return emissive_factor; };
1403+
double getOpacity() const override { return opacity; };
14031404

14041405
const Texture* textures[Texture::TextureType::COUNT];
14051406
Color diffuse_color;
@@ -1416,6 +1417,7 @@ struct MaterialImpl : Material
14161417
double ambient_factor;
14171418
double bump_factor;
14181419
double emissive_factor;
1420+
double opacity;
14191421
};
14201422

14211423

@@ -2699,6 +2701,10 @@ static OptionalError<Object*> parseMaterial(const Scene& scene, const Element& e
26992701
{
27002702
material->emissive_factor = (float)prop->getProperty(property_offset)->getValue().toDouble();
27012703
}
2704+
else if (prop->first_property->value == "Opacity")
2705+
{
2706+
material->opacity = (float)prop->getProperty(property_offset)->getValue().toDouble();
2707+
}
27022708
}
27032709
prop = prop->sibling;
27042710
}

src/ofbx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ struct Material : Object
426426
virtual double getAmbientFactor() const = 0;
427427
virtual double getBumpFactor() const = 0;
428428
virtual double getEmissiveFactor() const = 0;
429+
virtual double getOpacity() const = 0;
429430

430431
virtual const Texture* getTexture(Texture::TextureType type) const = 0;
431432
};

0 commit comments

Comments
 (0)