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

📄 shading.c

📁 该程序为MATLAB对CDMA系统个部分的仿真
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * MATLAB Compiler: 2.2
 * Date: Tue Jun 25 10:53:59 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" "sgl" "-m" "-W"
 * "main" "-L" "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
 * "libmwsglm.mlib" "exm110633_1" 
 */
#include "shading.h"
#include "libmatlbm.h"
#include "libmmfile.h"

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 mxArray * _mxarray0_;

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 mxArray * _mxarray2_;
static mxArray * _mxarray4_;
static mxArray * _mxarray5_;

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 mxArray * _mxarray6_;

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 mxArray * _mxarray8_;

static mxChar _array11_[4] = { 't', 'y', 'p', 'e' };
static mxArray * _mxarray10_;

static mxChar _array13_[4] = { 'a', 'x', 'e', 's' };
static mxArray * _mxarray12_;

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 mxArray * _mxarray14_;

static mxChar _array17_[5] = { 'c', 'o', 'l', 'o', 'r' };
static mxArray * _mxarray16_;

static mxChar _array19_[4] = { 'n', 'o', 'n', 'e' };
static mxArray * _mxarray18_;

static mxChar _array21_[7] = { 's', 'u', 'r', 'f', 'a', 'c', 'e' };
static mxArray * _mxarray20_;

static mxChar _array23_[5] = { 'p', 'a', 't', 'c', 'h' };
static mxArray * _mxarray22_;
static mxArray * _mxarray24_;

static mxChar _array26_[9] = { 'f', 'a', 'c', 'e', 'c', 'o', 'l', 'o', 'r' };
static mxArray * _mxarray25_;

static mxChar _array28_[10] = { 't', 'e', 'x', 't', 'u',
                                'r', 'e', 'm', 'a', 'p' };
static mxArray * _mxarray27_;

static mxChar _array30_[4] = { 'f', 'l', 'a', 't' };
static mxArray * _mxarray29_;

static mxChar _array32_[9] = { 'e', 'd', 'g', 'e', 'c', 'o', 'l', 'o', 'r' };
static mxArray * _mxarray31_;

static mxChar _array34_[6] = { 'i', 'n', 't', 'e', 'r', 'p' };
static mxArray * _mxarray33_;

static mxChar _array36_[7] = { 'f', 'a', 'c', 'e', 't', 'e', 'd' };
static mxArray * _mxarray35_;

static mxChar _array38_[5] = { 'b', 'l', 'a', 'c', 'k' };
static mxArray * _mxarray37_;

void InitializeModule_shading(void) {
    _mxarray0_ = mclInitializeString(132, _array1_);
    _mxarray2_ = mclInitializeString(131, _array3_);
    _mxarray4_ = mclInitializeDouble(1.0);
    _mxarray5_ = mclInitializeDouble(2.0);
    _mxarray6_ = mclInitializeString(38, _array7_);
    _mxarray8_ = mclInitializeString(28, _array9_);
    _mxarray10_ = mclInitializeString(4, _array11_);
    _mxarray12_ = mclInitializeString(4, _array13_);
    _mxarray14_ = mclInitializeString(46, _array15_);
    _mxarray16_ = mclInitializeString(5, _array17_);
    _mxarray18_ = mclInitializeString(4, _array19_);
    _mxarray20_ = mclInitializeString(7, _array21_);
    _mxarray22_ = mclInitializeString(5, _array23_);
    _mxarray24_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
    _mxarray25_ = mclInitializeString(9, _array26_);
    _mxarray27_ = mclInitializeString(10, _array28_);
    _mxarray29_ = mclInitializeString(4, _array30_);
    _mxarray31_ = mclInitializeString(9, _array32_);
    _mxarray33_ = mclInitializeString(6, _array34_);
    _mxarray35_ = mclInitializeString(7, _array36_);
    _mxarray37_ = mclInitializeString(5, _array38_);
}

void TerminateModule_shading(void) {
    mxDestroyArray(_mxarray37_);
    mxDestroyArray(_mxarray35_);
    mxDestroyArray(_mxarray33_);
    mxDestroyArray(_mxarray31_);
    mxDestroyArray(_mxarray29_);
    mxDestroyArray(_mxarray27_);
    mxDestroyArray(_mxarray25_);
    mxDestroyArray(_mxarray24_);
    mxDestroyArray(_mxarray22_);
    mxDestroyArray(_mxarray20_);
    mxDestroyArray(_mxarray18_);
    mxDestroyArray(_mxarray16_);
    mxDestroyArray(_mxarray14_);
    mxDestroyArray(_mxarray12_);
    mxDestroyArray(_mxarray10_);
    mxDestroyArray(_mxarray8_);
    mxDestroyArray(_mxarray6_);
    mxDestroyArray(_mxarray5_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static void Mshading(mxArray * arg1, mxArray * arg2);

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

/*
 * The function "mlfShading" 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 mlfShading(mxArray * arg1, mxArray * arg2) {
    mlfEnterNewContext(0, 2, arg1, arg2);
    Mshading(arg1, arg2);
    mlfRestorePreviousContext(0, 2, 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[]) {
    mxArray * mprhs[2];
    int i;
    if (nlhs > 0) {
        mlfError(_mxarray0_);
    }
    if (nrhs > 2) {
        mlfError(_mxarray2_);
    }
    for (i = 0; i < 2 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 2; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 2, mprhs[0], mprhs[1]);
    Mshading(mprhs[0], mprhs[1]);
    mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
}

/*
 * 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(mxArray * arg1, mxArray * arg2) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_shading);
    int nargin_ = mclNargin(2, arg1, arg2, NULL);
    mxArray * face = mclGetUninitializedArray();
    mxArray * i = mclGetUninitializedArray();
    mxArray * itext = mclGetUninitializedArray();
    mxArray * isurf = mclGetUninitializedArray();
    mxArray * imesh = mclGetUninitializedArray();
    mxArray * kids = mclGetUninitializedArray();
    mxArray * fc = mclGetUninitializedArray();
    mxArray * type = mclGetUninitializedArray();
    mxArray * ax = mclGetUninitializedArray();
    mxArray * ans = mclGetUninitializedArray();
    mclCopyArray(&arg1);
    mclCopyArray(&arg2);
    /*
     * %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));
     */
    mlfError(mclVe(mlfNargchk(_mxarray4_, _mxarray5_, mlfScalar(nargin_))));
    /*
     * if ischar(arg1)
     */
    if (mlfTobool(mclVe(mlfIschar(mclVa(arg1, "arg1"))))) {
        /*
         * % string input (check for valid option later)
         * if nargin == 2
         */
        if (nargin_ == 2) {
            /*
             * error('First argument must be an axes handle.')
             */
            mlfError(_mxarray6_);
        /*
         * end
         */
        }
        /*
         * ax = gca;
         */
        mlfAssign(&ax, mlfGca(NULL));
        /*
         * type = lower(arg1);
         */
        mlfAssign(&type, mlfLower(mclVa(arg1, "arg1")));
    /*
     * else
     */
    } else {
        /*
         * % make sure non string is a scalar handle
         * if length(arg1) > 1
         */
        if (mclLengthInt(mclVa(arg1, "arg1")) > 1) {
            /*
             * error('Axes handle must be a scalar');
             */
            mlfError(_mxarray8_);
        /*
         * end
         */
        }
        /*
         * % handle must be a handle and axes handle
         * if ~ishandle(arg1) | ~strcmp(get(arg1, 'type'), 'axes')
         */
        {
            mxArray * a_
              = mclInitialize(mclNot(mclVe(mlfIshandle(mclVa(arg1, "arg1")))));
            if (mlfTobool(a_)
                || mlfTobool(
                     mclOr(

⌨️ 快捷键说明

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