@dcl/ecs
Version:
Decentraland ECS
55 lines (54 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defineMaterialComponent = void 0;
const index_gen_1 = require("../generated/index.gen");
const TextureHelper = {
Common(texture) {
return {
tex: {
$case: 'texture',
texture
}
};
},
Avatar(avatarTexture) {
return {
tex: {
$case: 'avatarTexture',
avatarTexture
}
};
},
Video(videoTexture) {
return {
tex: {
$case: 'videoTexture',
videoTexture
}
};
}
};
function defineMaterialComponent(engine) {
const theComponent = (0, index_gen_1.Material)(engine);
return {
...theComponent,
Texture: TextureHelper,
setBasicMaterial(entity, material) {
theComponent.createOrReplace(entity, {
material: {
$case: 'unlit',
unlit: material
}
});
},
setPbrMaterial(entity, material) {
theComponent.createOrReplace(entity, {
material: {
$case: 'pbr',
pbr: material
}
});
}
};
}
exports.defineMaterialComponent = defineMaterialComponent;