MOD_util.c 核心代码部分, 关于 ModifierTypeInfo 的定义可以在 BKE_modifier.h 中看到非常详细的定义

/*

* ***** BEGIN GPL LICENSE BLOCK *****

*

* This program is free software; you can redistribute it and/or

* modify it under the terms of the GNU General Public License

* as published by the Free Software Foundation; either version 2

* of the License, or (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software Foundation,

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

*

* The Original Code is Copyright (C) 2005 by the Blender Foundation.

* All rights reserved.

*

* Contributor(s): Your name

*

* ***** END GPL LICENSE BLOCK *****

*

*/

/** \file blender/modifiers/intern/MOD_scaling.c

* \ingroup modifiers

*/

#include "DNA_meshdata_types.h"

#include "BLI_math.h"

#include "BLI_utildefines.h"

#include "BLI_string.h"

#include "MEM_guardedalloc.h"

#include "BKE_cdderivedmesh.h"

#include "BKE_particle.h"

#include "BKE_deform.h"

#include "MOD_modifiertypes.h"

#include "MOD_util.h"

static void initData(ModifierData *md)

{

ScalingModifierData *smd = (ScalingModifierData *) md;

smd->scale = 1.0f;

}

static void copyData(ModifierData *md, ModifierData *target)

{

ScalingModifierData *smd = (ScalingModifierData *) md;

ScalingModifierData *tsmd = (ScalingModifierData *) target;

tsmd->scale = smd->scale;

}

static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))

{

ScalingModifierData *smd = (ScalingModifierData *) md;

/* disable if modifier is 1.0 for scale*/

if (smd->scale == 1.0f) return 1;

return 0;

}

static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)

{

ScalingModifierData *smd = (ScalingModifierData *)md;

CustomDataMask dataMask = 0;

return dataMask;

}

static void ScalingModifier_do(

ScalingModifierData *smd, Object *ob, DerivedMesh *dm,

float (*vertexCos)[3], int numVerts)

{

int i;

float scale;

scale = smd->scale;

for (i = 0; i < numVerts; i++) {

vertexCos[i][0] = vertexCos[i][0] * scale;

vertexCos[i][1] = vertexCos[i][1] * scale;

vertexCos[i][2] = vertexCos[i][2] * scale;

}

}

static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,

float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))

{

DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);

ScalingModifier_do((ScalingModifierData *)md, ob, dm,

vertexCos, numVerts);

if (dm != derivedData)

dm->release(dm);

}

static void deformVertsEM(

ModifierData *md, Object *ob, struct BMEditMesh *editData,

DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)

{

DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);

ScalingModifier_do((ScalingModifierData *)md, ob, dm,

vertexCos, numVerts);

if (dm != derivedData)

dm->release(dm);

}

ModifierTypeInfo modifierType_Scaling = {

/* name */ "Scaling",

/* structName */ "ScalingModifierData",

/* structSize */ sizeof(ScalingModifierData),

/* type */ eModifierTypeType_OnlyDeform,

/* flags */ eModifierTypeFlag_AcceptsMesh |

eModifierTypeFlag_SupportsEditmode,

/* copyData */ copyData,

/* deformVerts */ deformVerts,

/* deformMatrices */ NULL,

/* deformVertsEM */ deformVertsEM,

/* deformMatricesEM */ NULL,

/* applyModifier */ NULL,

/* applyModifierEM */ NULL,

/* initData */ initData,

/* requiredDataMask */ requiredDataMask,

/* freeData */ NULL,

/* isDisabled */ isDisabled,

/* updateDepgraph */ NULL,

/* dependsOnTime */ NULL,

/* dependsOnNormals */ NULL,

/* foreachObjectLink */ NULL,

/* foreachIDLink */ NULL,

/* foreachTexLink */ NULL,

};

blender php,Blender 源码学习 --- Modifier相关推荐

  1. Vue源码学习 - 组件化一 createComponent

    Vue源码学习 - 组件化一 createComponent 组件化 createComponent 构造子类构造函数 安装组件钩子函数 实例化 VNode 总结 学习内容和文章内容来自 黄轶老师 黄 ...

  2. 【Android 源码学习】SystemServer启动原理

    Android 源码学习 SystemServer启动原理 望舒课堂 SystemServer进程启动原理学习记录整理. 参考文章: Android系统启动流程(三)解析SyetemServer进程启 ...

  3. Spring源码学习(四) | @Configuration的cglib动态代理

    文章目录 前言 例子 @Configuration :full or lite 设置 full or lite Cglib生成代理类AppConfig Where is it generated Ho ...

  4. Shiro源码学习之二

    接上一篇 Shiro源码学习之一 3.subject.login 进入login public void login(AuthenticationToken token) throws Authent ...

  5. Shiro源码学习之一

    一.最基本的使用 1.Maven依赖 <dependency><groupId>org.apache.shiro</groupId><artifactId&g ...

  6. mutations vuex 调用_Vuex源码学习(六)action和mutation如何被调用的(前置准备篇)...

    前言 Vuex源码系列不知不觉已经到了第六篇.前置的五篇分别如下: 长篇连载:Vuex源码学习(一)功能梳理 长篇连载:Vuex源码学习(二)脉络梳理 作为一个Web前端,你知道Vuex的instal ...

  7. vue实例没有挂载到html上,vue 源码学习 - 实例挂载

    前言 在学习vue源码之前需要先了解源码目录设计(了解各个模块的功能)丶Flow语法. src ├── compiler # 把模板解析成 ast 语法树,ast 语法树优化,代码生成等功能. ├── ...

  8. 2021-03-19Tomcat源码学习--WebAppClassLoader类加载机制

    Tomcat源码学习--WebAppClassLoader类加载机制 在WebappClassLoaderBase中重写了ClassLoader的loadClass方法,在这个实现方法中我们可以一窥t ...

  9. jQuery源码学习之Callbacks

    jQuery源码学习之Callbacks jQuery的ajax.deferred通过回调实现异步,其实现核心是Callbacks. 使用方法 使用首先要先新建一个实例对象.创建时可以传入参数flag ...

最新文章

  1. 基本概念之dos和cmd的区别
  2. JBoss日志文件配置
  3. while(1); 作用
  4. [pytorch、学习] - 5.7 使用重复元素的网络(VGG)
  5. mac 上mysql_connect_Warning: mysql_connect(): No such file or directory 解决方案总结(操作系统: Mac)...
  6. 想成为企业争抢的目标吗?你需要掌握的五大热门IT技能
  7. 《大数据》第2期“专题”——数据开放与政府治理创新
  8. 机器学习常见算法优缺点汇总
  9. 德阳计算机工程学校,德阳电子计算机工程学校2021年招生录取分数线
  10. 视频时代的下一幕 ABC Inspire:读懂视频
  11. dubbo调用原理,过程(知其然,知其所以然)
  12. 同时新增一个订单与多个明细的方法
  13. 深入浅出ES6的标准内置对象Proxy
  14. mgo EnsureIndex注意事项
  15. ramfs, rootfsinitramfs
  16. 关于移动端IOS input弹起键盘时,引起高度问题
  17. 北航2017级算法第一次上机---SkyLee的艾露猫
  18. Android 获取系统语言
  19. 服务器经常挂掉的6个原因
  20. 【Luogu_P2945】Sand Castle S

热门文章

  1. 问题四十四:怎么用ray tracing画空间任意位置的圆环的任意片段
  2. 物联网卡对企业设备的重要性
  3. 盐城大数据产业园人才公寓_盐城市大数据产业园获评大众创业万众创新示范基地...
  4. 布丰投针试验的仿真和误差估计
  5. matlab中asix off_MATLAB试卷+答案
  6. mysql -d -e_mysql常用函数
  7. java jama_java矩阵包jama的简单操作
  8. CDH修改PySpark默认的Python版本
  9. NVIDIA的python-GPU算法生态 ︱ RAPIDS 0.10
  10. Python中的闭包总结