What's the question?  I don't see any question marks. ;-)

Matt



Date: Sat, 18 Feb 2017 09:18:50 +0300
From: Andrew Prostrelov <[email protected]>
Subject: Define components which i can't see

Hi guys it's me again and another dope question:
Lets asume that we have array of components indices (for example edges)
randomly picked from object and array of component intersection coordinates
(3d world space or 3d local space).
We need to define, for current Camera, which components placed on a front
side of object(i can see them), and which one a placed on a backside of
object (can't see them behinde geo).

I tried to use ToolContext.Pick() and Pickbuffer mthods.
But when i use pickbuffer it miss alot and do not return any component
indices back. I assume that pickbuffer works good for polygon and big OGL
primitives and not so well for thin primitives (edge, verts).
Or maybe its a converting problem. 3D space coords are double and 2D space
coords are LONG (pixels).
So here is a part of code that i use for Pickbuffer:
    CStatus LastCompAvailable(ToolContext& in_ctxt, X3DObject& in_obj)
    {
        if(m_intersectcoords.GetCount() > 0)
        {
            PolygonMesh curMesh( in_obj.GetActivePrimitive().GetGeometry()
);
            LONG last_comp_idx = m_pickcomps[m_pickcomps.GetCount()-1];
            CVector3 last_comp_coord =
m_intersectcoords[m_intersectcoords.GetCount()-1];
            CVector3 last_comp_coord_screen_space;
            in_ctxt.WorldToView(last_comp_coord,
last_comp_coord_screen_space);     // convert 3D space coords to 2D space
coords
            Camera cur_cam = in_ctxt.GetCamera();
            CRefArray object;
            object.Add(in_obj.GetRef());
            PickBuffer curent_view_pickbuffer = in_ctxt.GetPickBuffer(0, 0,
0, 0, siEdgeFilter, object, siShaded);
            LONG x = (LONG)last_comp_coord_screen_space.GetX();
            LONG y = (LONG)last_comp_coord_screen_space.GetY();
            LONG check_comp_idx =
curent_view_pickbuffer.GetComponentIndexAtPosition(x, y);
            if(check_comp_idx != last_comp_idx)
                return CStatus::Fail;
        }
        return CStatus::OK;
    }

There's a chance of geo that, like a couple of mountains, can have
components with normals pointed to camera, but this components lies behind
part of geo that placed closer to current camera position, so we cannot see
them.
So dotprod+Normal method not an option i guess.

------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to