⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shading.cpp

📁 《精通Matlab6.5版》张志勇等编著
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//
// MATLAB Compiler: 2.2
// Date: Tue Jun 25 10:54:12 2002
// Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
// "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
// "array_indexing:on" "-O" "optimize_conditionals:on" "-B" "sglcpp" "-p" "-W"
// "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
// "libmwsglm.mlib" "exm110633_1" 
//
#include "shading.hpp"
#include "libmatlbm.hpp"
#include "libmmfile.hpp"

static mxChar _array1_[132] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 's', 'h', 'a', 'd', 'i',
                                'n', 'g', ' ', 'L', 'i', 'n', 'e', ':', ' ',
                                '1', ' ', 'C', 'o', 'l', 'u', 'm', 'n', ':',
                                ' ', '1', ' ', 'T', 'h', 'e', ' ', 'f', 'u',
                                'n', 'c', 't', 'i', 'o', 'n', ' ', '"', 's',
                                'h', 'a', 'd', 'i', 'n', 'g', '"', ' ', 'w',
                                'a', 's', ' ', 'c', 'a', 'l', 'l', 'e', 'd',
                                ' ', 'w', 'i', 't', 'h', ' ', 'm', 'o', 'r',
                                'e', ' ', 't', 'h', 'a', 'n', ' ', 't', 'h',
                                'e', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e',
                                'd', ' ', 'n', 'u', 'm', 'b', 'e', 'r', ' ',
                                'o', 'f', ' ', 'o', 'u', 't', 'p', 'u', 't',
                                's', ' ', '(', '0', ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(132, _array1_);

static mxChar _array3_[131] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 's', 'h', 'a', 'd', 'i',
                                'n', 'g', ' ', 'L', 'i', 'n', 'e', ':', ' ',
                                '1', ' ', 'C', 'o', 'l', 'u', 'm', 'n', ':',
                                ' ', '1', ' ', 'T', 'h', 'e', ' ', 'f', 'u',
                                'n', 'c', 't', 'i', 'o', 'n', ' ', '"', 's',
                                'h', 'a', 'd', 'i', 'n', 'g', '"', ' ', 'w',
                                'a', 's', ' ', 'c', 'a', 'l', 'l', 'e', 'd',
                                ' ', 'w', 'i', 't', 'h', ' ', 'm', 'o', 'r',
                                'e', ' ', 't', 'h', 'a', 'n', ' ', 't', 'h',
                                'e', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e',
                                'd', ' ', 'n', 'u', 'm', 'b', 'e', 'r', ' ',
                                'o', 'f', ' ', 'i', 'n', 'p', 'u', 't', 's',
                                ' ', '(', '2', ')', '.' };
static mwArray _mxarray2_ = mclInitializeString(131, _array3_);
static mwArray _mxarray4_ = mclInitializeDouble(1.0);
static mwArray _mxarray5_ = mclInitializeDouble(2.0);

static mxChar _array7_[38] = { 'F', 'i', 'r', 's', 't', ' ', 'a', 'r', 'g', 'u',
                               'm', 'e', 'n', 't', ' ', 'm', 'u', 's', 't', ' ',
                               'b', 'e', ' ', 'a', 'n', ' ', 'a', 'x', 'e', 's',
                               ' ', 'h', 'a', 'n', 'd', 'l', 'e', '.' };
static mwArray _mxarray6_ = mclInitializeString(38, _array7_);

static mxChar _array9_[28] = { 'A', 'x', 'e', 's', ' ', 'h', 'a', 'n', 'd', 'l',
                               'e', ' ', 'm', 'u', 's', 't', ' ', 'b', 'e', ' ',
                               'a', ' ', 's', 'c', 'a', 'l', 'a', 'r' };
static mwArray _mxarray8_ = mclInitializeString(28, _array9_);

static mxChar _array11_[4] = { 't', 'y', 'p', 'e' };
static mwArray _mxarray10_ = mclInitializeString(4, _array11_);

static mxChar _array13_[4] = { 'a', 'x', 'e', 's' };
static mwArray _mxarray12_ = mclInitializeString(4, _array13_);

static mxChar _array15_[46] = { 'S', 'h', 'a', 'd', 'i', 'n', 'g', ' ',
                                'm', 'e', 't', 'h', 'o', 'd', 's', ' ',
                                'a', 'r', 'e', ' ', 'f', 'l', 'a', 't',
                                ',', ' ', 'f', 'a', 'c', 'e', 't', 'e',
                                'd', ',', ' ', 'a', 'n', 'd', ' ', 'i',
                                'n', 't', 'e', 'r', 'p', '.' };
static mwArray _mxarray14_ = mclInitializeString(46, _array15_);

static mxChar _array17_[5] = { 'c', 'o', 'l', 'o', 'r' };
static mwArray _mxarray16_ = mclInitializeString(5, _array17_);

static mxChar _array19_[4] = { 'n', 'o', 'n', 'e' };
static mwArray _mxarray18_ = mclInitializeString(4, _array19_);

static mxChar _array21_[7] = { 's', 'u', 'r', 'f', 'a', 'c', 'e' };
static mwArray _mxarray20_ = mclInitializeString(7, _array21_);

static mxChar _array23_[5] = { 'p', 'a', 't', 'c', 'h' };
static mwArray _mxarray22_ = mclInitializeString(5, _array23_);
static mwArray _mxarray24_ = mclInitializeDoubleVector(0, 0, (double *)NULL);

static mxChar _array26_[9] = { 'f', 'a', 'c', 'e', 'c', 'o', 'l', 'o', 'r' };
static mwArray _mxarray25_ = mclInitializeString(9, _array26_);

static mxChar _array28_[10] = { 't', 'e', 'x', 't', 'u',
                                'r', 'e', 'm', 'a', 'p' };
static mwArray _mxarray27_ = mclInitializeString(10, _array28_);

static mxChar _array30_[4] = { 'f', 'l', 'a', 't' };
static mwArray _mxarray29_ = mclInitializeString(4, _array30_);

static mxChar _array32_[9] = { 'e', 'd', 'g', 'e', 'c', 'o', 'l', 'o', 'r' };
static mwArray _mxarray31_ = mclInitializeString(9, _array32_);

static mxChar _array34_[6] = { 'i', 'n', 't', 'e', 'r', 'p' };
static mwArray _mxarray33_ = mclInitializeString(6, _array34_);

static mxChar _array36_[7] = { 'f', 'a', 'c', 'e', 't', 'e', 'd' };
static mwArray _mxarray35_ = mclInitializeString(7, _array36_);

static mxChar _array38_[5] = { 'b', 'l', 'a', 'c', 'k' };
static mwArray _mxarray37_ = mclInitializeString(5, _array38_);

void InitializeModule_shading() {
}

void TerminateModule_shading() {
}

static void Mshading(mwArray arg1, mwArray arg2);

_mexLocalFunctionTable _local_function_table_shading
  = { 0, (mexFunctionTableEntry *)NULL };

//
// The function "shading" contains the normal interface for the "shading"
// M-function from file "d:\MATLAB6p1\toolbox\matlab\graph3d\shading.m" (lines
// 1-102). This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void shading(mwArray arg1, mwArray arg2) {
    Mshading(arg1, arg2);
}

//
// The function "mlxShading" contains the feval interface for the "shading"
// M-function from file "d:\MATLAB6p1\toolbox\matlab\graph3d\shading.m" (lines
// 1-102). The feval function calls the implementation version of shading
// through this function. This function processes any input arguments and
// passes them to the implementation version of the function, appearing above.
//
void mlxShading(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[2];
        int i;
        if (nlhs > 0) {
            error(_mxarray0_);
        }
        if (nrhs > 2) {
            error(_mxarray2_);
        }
        for (i = 0; i < 2 && i < nrhs; ++i) {
            mprhs[i] = mwArray(prhs[i], 0);
        }
        for (; i < 2; ++i) {
            mprhs[i].MakeDIN();
        }
        Mshading(mprhs[0], mprhs[1]);
    }
    MW_END_MLX();
}

//
// The function "Mshading" is the implementation version of the "shading"
// M-function from file "d:\MATLAB6p1\toolbox\matlab\graph3d\shading.m" (lines
// 1-102). It contains the actual compiled code for that M-function. It is a
// static function and must only be called from one of the interface functions,
// appearing below.
//
//
// function shading(arg1, arg2)
//
static void Mshading(mwArray arg1, mwArray arg2) {
    mwLocalFunctionTable save_local_function_table_
      (&_local_function_table_shading);
    int nargin_(nargin(2, mwVarargin(arg1, arg2)));
    mwArray face(mclGetUninitializedArray());
    mwArray i(mclGetUninitializedArray());
    mwArray itext(mclGetUninitializedArray());
    mwArray isurf(mclGetUninitializedArray());
    mwArray imesh(mclGetUninitializedArray());
    mwArray kids(mclGetUninitializedArray());
    mwArray fc(mclGetUninitializedArray());
    mwArray type(mclGetUninitializedArray());
    mwArray ax(mclGetUninitializedArray());
    mwArray ans(mclGetUninitializedArray());
    //
    // %SHADING Color shading mode.
    // %   SHADING controls the color shading of SURFACE and PATCH objects.
    // %   SURFACE and PATCH objects are created by the functions SURF, MESH,
    // %   PCOLOR, FILL, and FILL3. 
    // %
    // %   SHADING FLAT sets the shading of the current graph to flat.
    // %   SHADING INTERP sets the shading to interpolated.
    // %   SHADING FACETED sets the shading to faceted, which is the default.
    // %
    // %   Flat shading is piecewise constant; each mesh line segment or
    // %   surface patch has a constant color determined by the color value
    // %   at the end point of the segment or the corner of the patch which
    // %   has the smallest index or indices.
    // %
    // %   Interpolated shading, which is also known as Gouraud shading, is
    // %   piecewise bilinear; the color in each segment or patch varies linearly
    // %   and interpolates the end or corner values.
    // %
    // %   Faceted shading is flat shading with superimposed black mesh lines.
    // %   This is often the most effective and is the default.
    // %
    // %   SHADING(AX,...) uses axes AX instead of the current axes.
    // %
    // %   SHADING is an M-file that sets the EdgeColor and FaceColor properties
    // %   of all SURFACE objects in the current axes. It sets them to the
    // %   correct values that depend upon whether the SURFACE objects are
    // %   representing meshes or surfaces.
    // %
    // %   See also HIDDEN, SURF, MESH, PCOLOR, FILL, FILL3, SURFACE, PATCH.
    // 
    // %   Copyright 1984-2001 The MathWorks, Inc. 
    // %   $Revision: 5.16 $  $Date: 2001/04/15 11:58:56 $
    // 
    // error(nargchk(1,2,nargin));
    //
    error(mwVe(nargchk(_mxarray4_, _mxarray5_, nargin_)));
    //
    // if ischar(arg1)
    //
    if (tobool(mwVe(ischar(mwVa(arg1, "arg1"))))) {
        //
        // % string input (check for valid option later)
        // if nargin == 2
        //
        if (nargin_ == 2) {
            //
            // error('First argument must be an axes handle.')
            //
            error(_mxarray6_);
        //
        // end
        //
        }
        //
        // ax = gca;
        //
        ax = gca(mwArray::DIN);
        //
        // type = lower(arg1);
        //
        type = lower(mwVa(arg1, "arg1"));
    //
    // else
    //
    } else {
        //
        // % make sure non string is a scalar handle
        // if length(arg1) > 1
        //
        if (mclLengthInt(mwVa(arg1, "arg1")) > 1) {
            //
            // error('Axes handle must be a scalar');
            //
            error(_mxarray8_);
        //
        // end
        //
        }
        //
        // % handle must be a handle and axes handle
        // if ~ishandle(arg1) | ~strcmp(get(arg1, 'type'), 'axes')
        //
        {
            mwArray a_(~ mwVe(ishandle(mwVa(arg1, "arg1"))));
            if (tobool(a_)
                || tobool(
                     a_
                     | ~ mwVe(
                           strcmp(
                             mwVe(
                               Nget(
                                 1,
                                 mwVarargin(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -