feat: re-add uvScale, vertexScale to unlit material
This commit is contained in:
@@ -13,6 +13,14 @@ material {
|
|||||||
{
|
{
|
||||||
type : int,
|
type : int,
|
||||||
name : baseColorIndex
|
name : baseColorIndex
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: float2,
|
||||||
|
name: uvScale
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: float,
|
||||||
|
name: vertexScale
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
depthWrite : true,
|
depthWrite : true,
|
||||||
@@ -24,7 +32,7 @@ material {
|
|||||||
vertexDomain: object,
|
vertexDomain: object,
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment {
|
fragment {
|
||||||
void material(inout MaterialInputs material) {
|
void material(inout MaterialInputs material) {
|
||||||
prepareMaterial(material);
|
prepareMaterial(material);
|
||||||
material.baseColor = materialParams.baseColorFactor;
|
material.baseColor = materialParams.baseColorFactor;
|
||||||
@@ -32,7 +40,17 @@ material {
|
|||||||
if (materialParams.baseColorIndex > -1) {
|
if (materialParams.baseColorIndex > -1) {
|
||||||
highp float2 uv = getUV0();
|
highp float2 uv = getUV0();
|
||||||
uv.y = 1.0 - uv.y;
|
uv.y = 1.0 - uv.y;
|
||||||
|
uv *= materialParams.uvScale;
|
||||||
material.baseColor *= texture(materialParams_baseColorMap, uv);
|
material.baseColor *= texture(materialParams_baseColorMap, uv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vertex {
|
||||||
|
void materialVertex(inout MaterialVertexInputs material) {
|
||||||
|
float4 position = getPosition();
|
||||||
|
position.xyz *= materialParams.vertexScale;
|
||||||
|
material.worldPosition = getWorldFromModelMatrix() * position;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public:
|
|||||||
const char* extras = nullptr) override {
|
const char* extras = nullptr) override {
|
||||||
auto instance = mUnlitMaterial->createInstance();
|
auto instance = mUnlitMaterial->createInstance();
|
||||||
instance->setParameter("baseColorIndex", -1);
|
instance->setParameter("baseColorIndex", -1);
|
||||||
|
instance->setParameter("vertexScale", 1.0f);
|
||||||
|
instance->setParameter("uvScale", filament::math::float2 { 1.0f, 1.0f });
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ UNLIT_PACKAGE:
|
|||||||
UNLIT_UNLIT_OFFSET:
|
UNLIT_UNLIT_OFFSET:
|
||||||
.int 0
|
.int 0
|
||||||
UNLIT_UNLIT_SIZE:
|
UNLIT_UNLIT_SIZE:
|
||||||
.int 147641
|
.int 101492
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ _UNLIT_PACKAGE:
|
|||||||
_UNLIT_UNLIT_OFFSET:
|
_UNLIT_UNLIT_OFFSET:
|
||||||
.int 0
|
.int 0
|
||||||
_UNLIT_UNLIT_SIZE:
|
_UNLIT_UNLIT_SIZE:
|
||||||
.int 147641
|
.int 101492
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user