<commit_before>﻿import Material = require("./../Material");
import Program = require("../../Resources/Program/Program");
import BasicRenderer = require("../../Renderers/BasicRenderer");
import SceneObject = require("../../SceneObject");
import Vector3 = require("../../../Math/Vector3");
import Matrix = require("../../../Math/Matrix");
import Color4 = require("../../../Base/Color/Color4");
import Color3 = require('../../../Base/Color/Color3');
import TextureBase = require('../../Resources/Texture/TextureBase');
import Scene = require('../../Scene');
import ResolvedChainInfo = require('../../Renderers/ResolvedChainInfo');
import Vector4 = require("../../../Math/Vector4");
import PhongMaterial = require("./../Forward/PhongMaterial");
import IMaterialConfig = require("./../IMaterialConfig");
import RenderStageBase = require("../../Renderers/RenderStages/RenderStageBase");
declare function require(string): string;
/**
 * Provides how to write g-buffers.
 * This material have 3 pass for darawing g-buffers.
 * 1-st technique Normal.XY Depth Shiningness
 * 2-nd technique Diffuse.RGBA
 * 3-rd technique Specular.RGB
 */
class GBufferMaterial extends Material
{
    public get MaterialGroup(): string
    {
        return "jthree.materials.gbuffer";
    }

    private primaryProgram: Program;

    private secoundaryProgram: Program;

    private thirdProgram:Program;

    constructor()
    {
        super();
        var vs = require('../../Shaders/GBuffer/Vertex.glsl');
        var fs = require('../../Shaders/GBuffer/PrimaryFragment.glsl');
        this.primaryProgram = this.loadProgram("jthree.shaders.gbuffer.primary.vs", "jthree.shaders.gbuffer.primary.fs", "jthree.programs.gbuffer.primary", vs, fs);
        var fs = require('../../Shaders/GBuffer/SecoundaryFragment.glsl');
        this.secoundaryProgram = this.loadProgram("jthree.shaders.gbuffer.secoundary.vs", "jthree.shaders.gbuffer.secoundary.fs", "jthree.programs.gbuffer.secoundary", vs, fs);
        var fs = require('../../Shaders/GBuffer/ThirdFragment.glsl');
        this.thirdProgram = this.loadProgram("jthree.shaders.gbuffer.third.vs", "jthree.shaders.gbuffer.third.fs", "jthree.programs.gbuffer.third", vs, fs);
        this.setLoaded();
    }

    public configureMaterial(scene: Scene, renderStage: RenderStageBase, object: SceneObject, texs: ResolvedChainInfo,techniqueIndex:number,passIndex): void
    {
        if (!this.primaryProgram) return;
        var renderer = renderStage.Renderer;
        super.configureMaterial(scene, renderStage, object, texs,techniqueIndex,passIndex);
        switch (techniqueIndex)
        {
            case 0:
                this.configurePrimaryBuffer(scene, renderer, object, texs);
                break;
            case 1:
                this.configureSecoundaryBuffer(scene, renderer, object, texs);
                break;
            case 2:
                this.configureThirdBuffer(scene, renderer, object, texs);
                break;
        }<commit_msg>:sparkles: merge candidate for newMaterial'<commit_after>﻿import Material = require("./../Material");
import Program = require("../../Resources/Program/Program");
import BasicRenderer = require("../../Renderers/BasicRenderer");
import SceneObject = require("../../SceneObject");
import Vector3 = require("../../../Math/Vector3");
import Matrix = require("../../../Math/Matrix");
import Color4 = require("../../../Base/Color/Color4");
import Color3 = require('../../../Base/Color/Color3');
import TextureBase = require('../../Resources/Texture/TextureBase');
import Scene = require('../../Scene');
import ResolvedChainInfo = require('../../Renderers/ResolvedChainInfo');
import Vector4 = require("../../../Math/Vector4");
import PhongMaterial = require("./../Forward/PhongMaterial");
import IMaterialConfig = require("./../IMaterialConfig");
import RenderStageBase = require("../../Renderers/RenderStages/RenderStageBase");
import BasicMaterial = require("../Base/BasicMaterial");
declare function require(string): string;
/**
 * Provides how to write g-buffers.
 * This material have 3 pass for darawing g-buffers.
 * 1-st technique Normal.XY Depth Shiningness
 * 2-nd technique Diffuse.RGBA
 * 3-rd technique Specular.RGB
 */
class GBufferMaterial extends Material
{
    public get MaterialGroup(): string
    {
        return "jthree.materials.gbuffer";
    }

    private primaryProgram: Program;

    private secoundaryProgram: Program;

    private thirdProgram:Program;

    private primaryMaterial:BasicMaterial;

    private secoundaryMaterial:BasicMaterial;

    private thirdMaterial:BasicMaterial;

    constructor()
    {
        super();
        this.primaryMaterial = new BasicMaterial(require("../BuiltIn/GBuffer/PrimaryBuffer.html"));
        this.secoundaryMaterial = new BasicMaterial(require("../BuiltIn/GBuffer/SecoundaryBuffer.html"));
        this.thirdMaterial = new BasicMaterial(require("../BuiltIn/GBuffer/ThirdBuffer.html"));
        var vs = require('../../Shaders/GBuffer/Vertex.glsl');
        var fs = require('../../Shaders/GBuffer/PrimaryFragment.glsl');
        this.primaryProgram = this.loadProgram("jthree.shaders.gbuffer.primary.vs", "jthree.shaders.gbuffer.primary.fs", "jthree.programs.gbuffer.primary", vs, fs);
        var fs = require('../../Shaders/GBuffer/SecoundaryFragment.glsl');
        this.secoundaryProgram = this.loadProgram("jthree.shaders.gbuffer.secoundary.vs", "jthree.shaders.gbuffer.secoundary.fs", "jthree.programs.gbuffer.secoundary", vs, fs);
        var fs = require('../../Shaders/GBuffer/ThirdFragment.glsl');
        this.thirdProgram = this.loadProgram("jthree.shaders.gbuffer.third.vs", "jthree.shaders.gbuffer.third.fs", "jthree.programs.gbuffer.third", vs, fs);
        this.setLoaded();
    }

    public configureMaterial(scene: Scene, renderStage: RenderStageBase, object: SceneObject, texs: ResolvedChainInfo,techniqueIndex:number,passIndex): void
    {
        if (!this.primaryProgram) return;
        var renderer = renderStage.Renderer;
        super.configureMaterial(scene, renderStage, object, texs,techniqueIndex,passIndex);
        switch (techniqueIndex)
        {
            case 0:
                this.configurePrimaryBuffer(scene, renderer, object, texs);
                break;
            case 1:
                this.configureSecoundaryBuffer(scene, renderer, object, texs);
                break;
            case 2:
                this.configureThirdBuffer(scene, renderer, object, texs);
                break;
        }
{'fraction_non_alphanumeric': 0.1533026113671275, 'fraction_numerical': 0.004608294930875576, 'mean_word_length': 3.1817597944765574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5391678', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1776, 'n_words': 356}