本文整理汇总了C++中RefVec3::set方法的典型用法代码示例。如果您正苦于以下问题:C++ RefVec3::set方法的具体用法?C++ RefVec3::set怎么用?C++ RefVec3::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RefVec3
的用法示例。
在下文中一共展示了RefVec3::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JNIEXPORT void JNICALL Java_org_openscenegraph_osg_core_Vec3_nativeSet(JNIEnv *, jclass, jlong cptr,
jfloat x, jfloat y, jfloat z)
{
RefVec3 *v = reinterpret_cast<RefVec3 *>(cptr);
if(v != 0)
{
v->set(x,y,z);
}
}
示例2:
JNICALL jlong JNICALL Java_org_openscenegraph_osg_viewer_OffScreenViewer_nativeRaycast(JNIEnv* env, jclass, jlong viewer_cptr, jlong camera_ptr, jlong vec2array_cptr)
{
osg::Vec3Array* v3a = new osg::Vec3Array();
v3a->ref();
osgViewer::View* viewer = reinterpret_cast<osgViewer::View*>(viewer_cptr);
osg::Camera* cam = reinterpret_cast<osg::Camera*>(camera_ptr);
osg::Vec2Array* va = reinterpret_cast<osg::Vec2Array*>(vec2array_cptr);
osgUtil::LineSegmentIntersector::Intersections intersections;
for(uint i = 0; i < va->size(); i++)
{
if(i==0)
{
osg::Matrixf cmat = cam->getViewMatrix();
float* data = (float*)(cmat.ptr());
LOGI("[%f,%f,%f,%f]",data[0],data[1],data[2],data[3]);
LOGI("[%f,%f,%f,%f]",data[4],data[5],data[6],data[7]);
LOGI("[%f,%f,%f,%f]",data[8],data[9],data[10],data[11]);
LOGI("[%f,%f,%f,%f]",data[12],data[13],data[14],data[15]);
osg::Vec3 eye, center, up;
cam->getViewMatrixAsLookAt(eye,center,up);
LOGI("Eye: (%f,%f,%f) - Center: (%f,%f,%f) - Up: (%f,%f,%f)",eye.x(), eye.y(), eye.z(), center.x(), center.y(), center.z(), up.x(), up.y(), up.z());
}
viewer->computeIntersections(const_cast<const osg::Camera*>(cam), osgUtil::Intersector::WINDOW, va->at(i).x(), va->at(i).y(), intersections);
RefVec3 *refRes = new RefVec3();
if(intersections.empty() == false)
{
refRes->set(intersections.begin()->getWorldIntersectPoint().x(), intersections.begin()->getWorldIntersectPoint().y(), intersections.begin()->getWorldIntersectPoint().z());
}
else
{
refRes->set(DBL_MAX,DBL_MAX,DBL_MAX);
}
refRes->ref();
v3a->push_back(*refRes);
}
return reinterpret_cast<jlong>(v3a);
}