Pixel-Composer/scripts/d3d_material/d3d_material.gml
2023-08-30 16:40:45 +02:00

33 lines
No EOL
805 B
Text

function __d3dMaterial(surface = noone) constructor {
self.surface = surface;
self.diffuse = 1;
self.specular = 0;
self.metalic = false;
self.shine = 1;
self.normal = noone;
self.normalStr = 1;
self.reflective = 0;
static getTexture = function() {
if(!is_surface(surface)) return -1;
return surface_get_texture(surface);
}
static submitGeometry = function() {
shader_set_i("use_normal", is_surface(normal));
shader_set_surface("normal_map", normal);
shader_set_f("normal_strength", normalStr);
}
static submitShader = function() {
shader_set_f("mat_diffuse", diffuse );
shader_set_f("mat_specular", specular );
shader_set_f("mat_shine", shine );
shader_set_i("mat_metalic", metalic );
shader_set_f("mat_reflective", reflective);
}
}