osg for android学习之pagedlod

本文介绍如何在Android设备上利用osg库实现PagedLOD技术,通过变换节点来解决动态链接问题。代码示例展示了如何创建和管理PagedLOD节点,并提供了一个自定义的XPageLODGroup类。
摘要由CSDN通过智能技术生成

首先这个在android上是支持的

其次,想用文件名加坐标加trans,是不行的,会提示动态链接缺少,osgdb方面的

所以只有用变换节点来实现

以下是小米手机,400个3m的模型,压力不大,纹理没渲染出来,如果纹理渲染出来了,应该开始卡了。


奉献一个代码

#pragma once

//Standard libraries
#include "JNIUtils.h"
#include <string>
#include <sstream>

#include <osg/Vec3>
#include <osg/Node>
#include <osg/Group>
#include <osg/MatrixTransform>
#include <osg/PagedLOD>

#include <osgDB/ReadFile>

struct PageLODFileRang
{
 std::string fileName;
 float minDistance;
 float maxDistance;
public :
    PageLODFileRang(const std::string& file,const float& min,const float& max)
     {
        fileName = file;
        minDistance = min;
        maxDistance = max;
     }
};
class XPageLODGroup:
    public osg::Group
{
private:
    std::vector <PageLODFileRang> m_pageLODFileData;
    std::vector<osg::Vec3> m_positionList;

public:
    XPageLODGroup();
    XPageLODGroup( const std::vector<PageLODFileRang>& pageLODFileData, const std::vector<osg::Vec3>& positionList);
    ~XPageLODGroup(voi

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值