public SSInstancedCylinderShaderProgram(string preprocessorDefs = "#define INSTANCE_DRAW")
        {
            m_programID = GL.CreateProgram();

            _vertexShader = SSAssetManager.GetInstance<SSVertexShader>(
                basePath + "cylinder_vertex.glsl");
            _vertexShader.Prepend(preprocessorDefs);
            _vertexShader.LoadShader();
            attach(_vertexShader);

            _fragmentShader = SSAssetManager.GetInstance<SSFragmentShader>(
                basePath + "cylinder_fragment.glsl");
            _fragmentShader.Prepend(preprocessorDefs);
            _fragmentShader.LoadShader();
            attach(_fragmentShader);

            link();

            Activate();

            u_screenWidth = getUniLoc("screenWidth");
            u_screenHeight = getUniLoc("screenHeight");
            u_viewMatrix = getUniLoc("viewMatrix");
            u_viewMatrixInverse = getUniLoc("viewMatrixInverse");
            u_distanceToAlpha = getUniLoc("distanceToAlpha");
            u_alphaMin = getUniLoc("alphaMin");
            u_alphaMax = getUniLoc("alphaMax");

            a_cylinderPos = getAttrLoc("cylinderCenter");
            a_cylinderAxis = getAttrLoc("cylinderAxis");
            a_prevJointAxis = getAttrLoc("prevJointAxis");
            a_nextJointAxis = getAttrLoc("nextJointAxis");
            a_cylinderWidth = getAttrLoc("cylinderWidth");
            a_cylinderLength = getAttrLoc("cylinderLength");
            a_cylinderColor = getAttrLoc("cylinderColor");
            a_cylinderInnerColor = getAttrLoc("cylinderInnerColor");
            a_innerColorRatio = getAttrLoc("innerColorRatio");
            a_outerColorRatio = getAttrLoc("outerColorRatio");

            m_isValid = checkGlValid();

            this.UniDistanceToAlpha = 0.1f;
            this.UniAlphaMin = 0.0f;
            this.UniAlphaMax = 0.6f;
        }
예제 #2
0
        public SSInstancedCylinderShaderProgram(string preprocessorDefs = "#define INSTANCE_DRAW")
        {
            m_programID = GL.CreateProgram();

            _vertexShader = SSAssetManager.GetInstance <SSVertexShader>(
                basePath + "cylinder_vertex.glsl");
            _vertexShader.Prepend(preprocessorDefs);
            _vertexShader.LoadShader();
            attach(_vertexShader);

            _fragmentShader = SSAssetManager.GetInstance <SSFragmentShader>(
                basePath + "cylinder_fragment.glsl");
            _fragmentShader.Prepend(preprocessorDefs);
            _fragmentShader.LoadShader();
            attach(_fragmentShader);

            link();

            Activate();

            u_screenWidth       = getUniLoc("screenWidth");
            u_screenHeight      = getUniLoc("screenHeight");
            u_viewMatrix        = getUniLoc("viewMatrix");
            u_viewMatrixInverse = getUniLoc("viewMatrixInverse");
            u_distanceToAlpha   = getUniLoc("distanceToAlpha");
            u_alphaMin          = getUniLoc("alphaMin");
            u_alphaMax          = getUniLoc("alphaMax");

            a_cylinderPos        = getAttrLoc("cylinderCenter");
            a_cylinderAxis       = getAttrLoc("cylinderAxis");
            a_prevJointAxis      = getAttrLoc("prevJointAxis");
            a_nextJointAxis      = getAttrLoc("nextJointAxis");
            a_cylinderWidth      = getAttrLoc("cylinderWidth");
            a_cylinderLength     = getAttrLoc("cylinderLength");
            a_cylinderColor      = getAttrLoc("cylinderColor");
            a_cylinderInnerColor = getAttrLoc("cylinderInnerColor");
            a_innerColorRatio    = getAttrLoc("innerColorRatio");
            a_outerColorRatio    = getAttrLoc("outerColorRatio");

            m_isValid = checkGlValid();

            this.UniDistanceToAlpha = 0.1f;
            this.UniAlphaMin        = 0.0f;
            this.UniAlphaMax        = 0.6f;
        }