/*Title: mjbWorld
Copyright (c) 1998-2005 Martin John Baker
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.
For information about the GNU General Public License see http://www.gnu.org/
To discuss this program http://sourceforge.net/forum/forum.php?forum_id=122133
also see website http://www.euclideanspace.com/
translated to C++ by Ed Sinjiashvili (slorcim@sf.net)
*/
#include <qobjectlist.h>
#include "transformGroupBean.h"
#include "vetoPropertyChange.h"
#include "d_button.h"
#include "sfvec3f.h"
#include "mfint32.h"
#include "mfvec3f.h"
#include "sfrotation.h"
#include "mfparam.h"
#include "sfvec3fEditor.h"
#include "sfrotationEditor.h"
#include "sftransform.h"
#include "sceneBean.h"
#include "sftransformEditor.h"
#include "behaviorBean.h"
namespace mjbModel
{
int transformGroupBean::TOOL_CONVERTTOJOINT = 1;
QString transformGroupBean::PAR_ROTATION = "rotation";
QString transformGroupBean::PAR_CENTRE = "center";
QString transformGroupBean::PAR_SCALE = "scale";
QString transformGroupBean::PAR_SCALEORIENTATION = "scaleOrientation";
QString transformGroupBean::PAR_TRANSLATION = "translation";
QString transformGroupBean::PAR_TRANSFORM = "transform";
QString transformGroupBean::PAR_MATRIX = "matrix";
sfvec3f& transformGroupBean::defaultCenter()
{
static sfvec3f d(0.0, 0.0, 0.0);
return d;
}
sfrotation& transformGroupBean::defaultRotation()
{
static sfrotation d(0,0,1,0.0);
return d;
}
sfvec3f& transformGroupBean::defaultScale()
{
static sfvec3f d(1.0,1.0,1.0);
return d;
}
sfrotation& transformGroupBean::defaultScaleOrientation()
{
static sfrotation d(0,0,1,0.0);
return d;
}
sfvec3f& transformGroupBean::defaultTranslation()
{
static sfvec3f d(0.0,0.0,0.0);
return d;
}
transformGroupBean::~transformGroupBean ()
{
delete vetos;
}
transformGroupBean::transformGroupBean ()
: groupBean (),
matrix (0), matrix1 (0), matrix2 (0),
matrix3 (0), matrix4 (0),
top (0), bottom (0), mult (0)
{
vetos = new vetoPropertyChange;
// sets up children params
params_->insert(new sfparam(sfparam::EXPOSEDFIELD,
sfvec3f::Factory (),
PAR_CENTRE, &defaultCenter()));
params_->insert(new sfparam(sfparam::EXPOSEDFIELD,
sfrotation::Factory (),
PAR_ROTATION,&defaultRotation()));
params_->insert(new sfparam(sfparam::EXPOSEDFIELD,
sfvec3f::Factory (),
PAR_SCALE, &defaultScale()));
params_->insert(new sfparam(sfparam::EXPOSEDFIELD,
sfrotation::Factory (),
PAR_SCALEORIENTATION, &defaultScaleOrientation()));
params_->insert(new sfparam(sfparam::EXPOSEDFIELD,
sfvec3f::Factory (),
PAR_TRANSLATION, &defaultTranslation()));
applyTemp = false;
}
void transformGroupBean::setDefaultTranslation(sfvec3f* /*d*/)
{
sfparam* par = params_->findSFParam(PAR_TRANSLATION);
par->setDefault(new sfvec3f(1000.0,1000.0,1000.0));
}
void transformGroupBean::setTrans(sfvec3f* shift, mfint32* instance)
{
set(PAR_TRANSLATION,shift,instance);
//Console.WriteLine("transformGroupBean::setTranslation("+shift+","+instance+")");
int inst =0;
if (instance!=0)
if(instance->howmany()>0) inst=instance->getLastValue();
setMatrix(calcTransform(inst, 0, 0, 0, 0, 0),inst);
// Console.WriteLine("tranformGroupBean::setTranslation("+instance+") veto " + pve->getPropertyChangeEvent());
}
void transformGroupBean::setTranslationAndRotation(sfparam* shift, sfparam* rot,
nodeBean* /*callback*/)
{
//Console.WriteLine("transformgroupBean.setTranslationAndRotation("+shift+","+callback.generateUniqueName()+") this="+generateUniqueName());
if (shift!=0)
{
sfparam* par = params_->findSFParam(PAR_TRANSLATION);
vector<mjbModel::Property*>* vecs = shift->getArray();
par->setArray(vecs);
if (vecs==0)
{
// if array is 0
// FIXME: try/catch
// try {
//Console.WriteLine("transformgroupBean.setTranslation("+shift+") vecs==0");
vetos->fireVetoableChange(PAR_TRANSLATION,0,shift); // if translation==shift veto is not fired
/*
} catch (ConstraintException pve){
if (callback is kinematicsBean) {
((kinematicsBean)callback).veto(0,pve.Message);
}
}
*/
}
else
{
// if array is not 0
//Console.WriteLine("transformgroupBean.setTranslation("+shift+") vecs!=0 this="+generateUniqueName());
// int[] instance = new int[1];
for (int i=0;i < (int)vecs->size ();i++)
{
// instance[0]=i;
//Console.WriteLine(" >transformgroupBean.setTranslation("+shift+") i="+i+" this="+generateUniqueName());
setMatrix(calcTransform(i,0,0,0,0,0),i); // setMatrix updates Java3D scenegraph
if ( (*vecs)[i] !=0)
{
// FIXME: try/catch
// try {
//Console.WriteLine("transformgroupBean.setTranslation vecs["+i+"]"+vecs[i]);
vetos->fireVetoableChange(PAR_TRANSLATION,0, (*vecs)[i]); // if translation==shift veto is not fired
//Console.WriteLine("transformgroupBean.setTranslation veto not fired");
/*
} catch (ConstraintException pve){
//Console.WriteLine("transformgroupBean.setTranslation veto fired");
if (callback is kinematicsBean) {
((kinematicsBean)callback).veto(i,pve.Message);
}
}
*/
}
}
}
}
if (rot!=0)
{
vector<mjbModel::Property*>* vecs = rot->getArray();
sfparam* par2 = params_->findSFParam(PAR_ROTATION);
par2->setArray(vecs);
if (vecs==0)
{
// FIXME: try/catch
// try {
//Console.WriteLine("transformgroupBean.setRotation("+shift+") vecs==0");
vetos->fireVetoableChange(PAR_ROTATION,0,rot); // if translation==shift veto is not fired
/*
} catch (ConstraintException pve){
if (callback is kinematicsBean) {
((kinematicsBean)callback).veto(0,pve.Message);
}
}
*/
}
没有合适的资源?快使用搜索试试~ 我知道了~
mjbWorld_cpp_qt_opengl_source_525a.zip
共416个文件
h:196个
cpp:188个
root:4个
需积分: 5 0 下载量 140 浏览量
2024-09-21
12:18:09
上传
评论
收藏 777KB ZIP 举报
温馨提示
C++三维程序
资源推荐
资源详情
资源评论
收起资源包目录
mjbWorld_cpp_qt_opengl_source_525a.zip (416个子文件)
AUTHORS 17B
ChangeLog 0B
COPYING 18KB
transformGroupBean.cpp 61KB
sfparam.cpp 46KB
nodeBean.cpp 44KB
geometryBean.cpp 38KB
triangleHolder.cpp 35KB
mfparam.cpp 30KB
kinematicsBean.cpp 25KB
ifsBean.cpp 23KB
mfnode.cpp 20KB
sftransform.cpp 20KB
mjbFrame.cpp 19KB
viewPlatformBean.cpp 19KB
behaviorBean.cpp 18KB
frame2d.cpp 18KB
protoBean.cpp 17KB
particleArrayBean.cpp 17KB
groupBean.cpp 17KB
mfint32.cpp 15KB
mfvec3f.cpp 15KB
boxBean.cpp 15KB
cylinderBean.cpp 14KB
coordinateBean.cpp 14KB
s_canvas3d.cpp 14KB
multipleBean.cpp 14KB
filter_base.cpp 14KB
appearanceBean.cpp 14KB
protoInstanceBean.cpp 13KB
collisionActionBean.cpp 13KB
constraintBean.cpp 13KB
extrusionBean.cpp 13KB
planeSensorBean.cpp 13KB
coneBean.cpp 12KB
sphereBean.cpp 12KB
externProtoBean.cpp 12KB
timeSensorBean.cpp 12KB
normalBean.cpp 12KB
backgroundBean.cpp 11KB
controlPointBean.cpp 11KB
baseEditor.cpp 11KB
mfcolor.cpp 11KB
shape3dBean.cpp 11KB
textureCoordinateBean.cpp 11KB
cylinderSensorBean.cpp 11KB
frameQuickShape.cpp 11KB
sfrotation.cpp 11KB
mfvec2f.cpp 10KB
sceneBean.cpp 10KB
colorBean.cpp 10KB
sphereSensorBean.cpp 10KB
materialBean.cpp 10KB
arrayEditor.cpp 10KB
d_editProperty.cpp 9KB
mfstring.cpp 9KB
sftransformEditor.cpp 9KB
touchSensorBean.cpp 9KB
blobBean.cpp 9KB
linkBean.cpp 8KB
filter_obj.cpp 8KB
textureBean.cpp 8KB
mfrotation.cpp 8KB
routeBean.cpp 8KB
orientationInterpolatorBean.cpp 8KB
mfedge.cpp 8KB
pointLightBean.cpp 8KB
dynamicsBean.cpp 8KB
sfvec3f.cpp 8KB
routePropertyChange.cpp 8KB
coordinateInterpolatorBean.cpp 8KB
normalInterpolatorBean.cpp 8KB
lightBean.cpp 8KB
mffloat.cpp 8KB
mfpropertyMap.cpp 8KB
sfnode.cpp 7KB
screenCP.cpp 7KB
scoreBean.cpp 7KB
lodBean.cpp 7KB
positionInterpolatorBean.cpp 7KB
colorInterpolatorBean.cpp 7KB
textBean.cpp 7KB
frameProperties.cpp 7KB
directionaLlightBean.cpp 7KB
d_hanim.cpp 7KB
polygonAttributesBean.cpp 7KB
scalarInterpolatorBean.cpp 7KB
frameTree.cpp 7KB
sfrotationEditor.cpp 7KB
elivationGridBean.cpp 7KB
sfvec3fEditor.cpp 7KB
collisionDetectBean.cpp 7KB
frameLayout.cpp 7KB
moveCanvas.cpp 6KB
d_cp.cpp 6KB
frameAdd.cpp 6KB
soundBean.cpp 6KB
sfimage.cpp 6KB
mjbModel.cpp 6KB
d_2d.cpp 6KB
共 416 条
- 1
- 2
- 3
- 4
- 5
资源评论
fanxbl957
- 粉丝: 1510
- 资源: 1141
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Vue、Java、JavaScript和HTML的“久久爱宠”宠物店管理系统设计源码
- 基于Python的Rime输入法配置与使用技巧设计源码
- 基于TypeScript和前端框架的华中科技大学开源镜像站设计源码
- 广东东莞含街道geojson
- 基于MQTT协议的ESP32远程遥控小车
- 适用于 YOLO-Pose 模型的 NVIDIA DeepStream SDK 6.3 , 6.2 , 6.1.1 , 6.1 , 6.0.1 , 6.0 应用程序.zip
- 基于Raspberry Pi的dingdang-robot中文语音对话机器人设计源码
- 基于HTML的ABAP程序设计源码与编程交流平台
- 基于Spring Boot与Mybatis的Java点歌系统设计源码
- 基于Spring Boot的Java-Lib设计源码,全面集成Java和HTML技术库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功