【OpenSceneGraph】UpdateCallback Example

OSG学习笔记3-使用回调实现旋转动画 这是有关节点的更新与事件回调,OSG中的节点主要是使用回调Callback来完成用户临时定义的,需要每帧执行的工作。 回调时一种用户编写的功能模块,它可以作为一个参数传递给其他功能模块,从而实现一些底层系统事件的响应和处理。C++使用函数指针将回调函数的地址作为其他系统或用户函数的传入参数。 OSG节点回调分类: 1、更新回调 Update Callback:每一帧系统遍历到当前节点时都会被 阅读详情

        OpenSceneGraph是一个跨平台的开源三维库,被广泛的应用在游戏、虚拟现实、三维重建、地理信息等领域。OSG提供了基于OpenGL的面向对象框架,使得开发者能够轻松的实现或优化底层图形接口调用,并且其拥有的众多工具为图形应用的快速开发提供最大程度的便捷。

        本例给出OpenSceneGraph中,更新回调操作(UpdateCallback)的一个简单用例。

        通过模拟LOD细节层次算法,对圆柱面的Geometry绑定更新回调操作,通过计算视点到包围盒的距离,然后对圆柱面进行动态设置划分阈值。


程序运行结果如下:




main函数

#include "stdafx.h"

#include "tool.h"
#include "callbacks.h"
#include <string.h>
#include <string>

void createCylinder(osgViewer::Viewer* viewer, void* grp, void* geometry, float* center, float radius, float height, unsigned char * color) {
	if
探索未知种族之osg类生物---渲染遍历之裁剪一 前言 上面我们用了四节课的内容,讲解了一些osg概念性的内部原理。希望大家可以再看今天的讲解之前先再仔细的研究一下前四节的内容。这样你就会对整个osg的渲染过程有一个更加清晰的认知,有助于理解下面两个函数cull()和draw()。 osg::Util::SceneView::cull() 好,相信大家已经又复习了上面几节的内容,那我们就进行sceneView的第一个重要功能osg::U... 阅读详情

相关推荐

OsgEarth中设置模型运动路径,并绘制雷达扫描、动态实时绘制运动轨迹、跟随彩带

工程结构需求加载机场和飞机创建飞机历史航迹设置飞机视角跟随 并设置飞行路径创建飞机飞行彩带计算飞机飞行姿态TrailerCallback.hTrailerCallback.cppCreateTrackCallbcak.hCreateTrackCallbcak.cppBuildRader.hBuildRader.cppBuildRaderCallback.cppBuildRaderCallback.h #BuildRader/BuildRaderCallback 主要用来处理雷达相关操作 #CreateT

不会游泳的程序猿 1万+

osg 学习 2 UpdateCallback, EventHandler, 运动的相机

下午读了《osg开源教程》 ,对callback, EventHandler 理解更好了点。晚上回来试试这两个例子。      callback 是单纯的场景内节点附属功能, 当遍历到某个附带callback的节点,其中重载的operator()函数将被执行,比如修改该节点的坐标等等;     EventHandler 是窗口/视口事件(gui)响应,就是窗口内点下鼠标,或者按下某个键

lizhengjiang的专栏 1382

OpenSceneGraph源码分析:osgQt模块

济南友泉软件有限公司 osgQt基于QGLWidget实现了在Qt窗口内OSG渲染操作。Qt以其开源、跨平台、使用方便、现代化的界面风格等优点,目前已经成为了桌面版CAD/CAE/CAM等软件GUI开发的首选,因此,非常有必要在OSG的基础之上,研究Qt桌面系统内继承OSG渲染功能的相关技术。 注1:文章内容会不定期更新。 注2:限于笔者研究水平,难免有表述不当,敬请谅解。 零、系统配置 操作系统 WIndows 10 64bit 编译器 Visual Studio 2019

国产CAx(CAD/CAE/CAM)软件研发 1496

基础篇.ARM架构介绍(1)

ARM公司主要向客户提供处理器IP。ARM体系结构是一种硬件规范,主要用来约定指令集、芯片内部体系结构等。以指令集为例,ARM体系结构并没规定每一条指令在硬件IP中如何实现,只是约定了每条指令的格式、行为规范、参数等。

heshuangzong的博客 7801

DCDC: 前馈电容优化环路稳定性的设计与验证方法

本文深入探讨了DCDC转换器中前馈电容对环路稳定性的优化设计与验证方法。通过分析前馈电容的作用原理、选型计算和实验验证,详细介绍了如何利用穿越频率和相位裕度等关键参数提升系统性能。文章还提供了实用的设计经验和问题排查技巧,帮助工程师在实际应用中实现DCDC转换器的最佳稳定性。

weixin_42531516的博客 437

淘宝抓包,直达函数内部request请求体和response响应体, 告别FD, Charles,SSL,justtrustme 等http代理,证书工具。

淘宝抓包,hook发包函数,直接获取response相应数据

binary66的博客 4468

华为海思2026届数字IC秋招笔试真题解析与实战技巧(2025最新版)

本文深度解析华为海思2026届数字IC秋招笔试真题,涵盖高频考点如后端设计、低功耗设计、SystemVerilog语法等核心内容。提供时序违例修复、时钟树综合等实战技巧,帮助考生高效备考。特别关注UPF低功耗设计规范等最新考点,助力考生在秋招笔试中脱颖而出。

lg888的博客 1088

OpenAI Codex 科研实战:从文献整理到论文初稿的自动化流水线

在科研工作中,大量时间消耗在文献整理、数据清洗、结果反复排版等重复性任务上,而非真正的思考与创新。AI 编程代理作为一种能理解自然语言指令并直接操作文件、执行脚本的命令行工具,正逐渐改变科研工作流的组织方式。它基于云端大模型推理,本地无需 GPU,通过解析用户意图,自动完成代码生成、文件批量处理与任务拆解,将传统需要手动操作的工程过程转化为可验证、可追溯的指令执行。这类工具在学术场景中的价值尤为突出:科研人员可以将文献总结、数据预处理、统计分析与可视化出图交给代理完成,从而把精力聚焦在研究问题本身。Open

weixin_34318326的博客 458

Word公式批量转MathType终极指南:解决omml2mml.xsl缺失与格式调整难题

本文提供Word公式批量转MathType的终极解决方案,重点解决常见的omml2mml.xsl文件缺失问题,并详细讲解批量转换与格式调整技巧。通过补全文件路径、分批次转换及样式预设等方法,大幅提升学术论文公式编辑效率,适用于Office 2016及以上版本。

weixin_28419039的博客 1348

OAI-5G开源通信平台实践(一)-安装 部署及RFsimulator基本测试

OAI (Open Air Interface) 是目前开源5G/4G项目中最完善、最成熟的一个,并且仍然在持续更新。其包含基站、终端及核心网网元的代码,可基于x86\arm+射频卡搭建实际硬件平台,也可在x86平台上对rf\phy等层进行模拟,做各网元协议栈的单独测试验证。本文总结了x86平台下,oai的安装及运行方式。包括NTN分支和主分支的rf simulator、nos1、端到端部署等场景的验证流程,同时总结了验证过程中遇到的问题及解决方法。

十年通信老兵的技术修炼之路——从3G到5G,从地面基站到卫星通信。 2963

大模型自我认知微调的实战教程

本文主要介绍了大模型自我认知微调的实战教程,希望对学习大语言模型的同学们有所帮助。微调成功并保留原有能力的截图如下所示: 文章目录 1. 前言 2. 配置环境 2.1 安装虚拟环境 2.2 安装依赖库 3. 实战代码 3.1 配置数据集 3.2 lora微调

herosunly的博客 4万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

上一篇: 个人博客开用啦
下一篇: 【unp】unix网络编程卷1-->环境搭建(ubuntu14.04)
小do在努力
博客等级 码龄16年 58粉丝 161原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值