Beispiel #1
0
static inline void DrawSkeleton(Animation_Joint *jointList, size_t jointCount, AnimationState *animState, M4 modelMatrix) {
  M4 *globalJointPoses = (M4 *)Memory::FrameStackPointer(animState->globalPoseOffset);
  for (size_t i = 0; i < jointCount; i++) {
    Animation_Joint *joint = &jointList[i];
    DrawBone((S32)i, jointList, globalJointPoses, modelMatrix);
  }
}
Beispiel #2
0
	void CSkeleton::DrawBones(	Util::TextureInfo* p_pTexture,
								const double p_cdX,
								const double p_cdY, 
								Joint* p_pRoot) const
	{
		double dCurX = p_cdX;
		double dCurY = p_cdY;

        DEBUG(4, __FUNCTION__, "-------------------");
		Joint* pCurrent = p_pRoot;
        Joint* pParent = NULL;
		while(pCurrent != nullptr)
		{
            DEBUG(4, "Start X", dCurX);
            DEBUG(4, "Start Y", dCurY);
            DEBUG(4, "End X", pCurrent->m_Bone.m_dX);
            DEBUG(4, "End Y", pCurrent->m_Bone.m_dY);
			DrawBone(p_pTexture, dCurX, dCurY, pCurrent->m_Bone, pCurrent->m_Skin, pCurrent->m_dCenter);
			dCurX += pCurrent->m_Bone.m_dX;
			dCurY -= pCurrent->m_Bone.m_dY;
            pParent = pCurrent;
			pCurrent = pCurrent->m_pChild;
		}
	}
Beispiel #3
0
/// <summary>
/// Draws a body
/// </summary>
/// <param name="pJoints">joint data</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
void CBodyBasics::DrawBody(const Joint* pJoints, const D2D1_POINT_2F* pJointPoints)
{
    // Draw the bones

    // Torso
    DrawBone(pJoints, pJointPoints, JointType_Head, JointType_Neck);
    DrawBone(pJoints, pJointPoints, JointType_Neck, JointType_SpineShoulder);
    DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_SpineMid);
    DrawBone(pJoints, pJointPoints, JointType_SpineMid, JointType_SpineBase);
    DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderRight);
    DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderLeft);
    DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipRight);
    DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipLeft);

    // Right Arm
    DrawBone(pJoints, pJointPoints, JointType_ShoulderRight, JointType_ElbowRight);
    DrawBone(pJoints, pJointPoints, JointType_ElbowRight, JointType_WristRight);
    DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_HandRight);
    DrawBone(pJoints, pJointPoints, JointType_HandRight, JointType_HandTipRight);
    DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_ThumbRight);

    // Left Arm
    DrawBone(pJoints, pJointPoints, JointType_ShoulderLeft, JointType_ElbowLeft);
    DrawBone(pJoints, pJointPoints, JointType_ElbowLeft, JointType_WristLeft);
    DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_HandLeft);
    DrawBone(pJoints, pJointPoints, JointType_HandLeft, JointType_HandTipLeft);
    DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_ThumbLeft);

    // Right Leg
    DrawBone(pJoints, pJointPoints, JointType_HipRight, JointType_KneeRight);
    DrawBone(pJoints, pJointPoints, JointType_KneeRight, JointType_AnkleRight);
    DrawBone(pJoints, pJointPoints, JointType_AnkleRight, JointType_FootRight);

    // Left Leg
    DrawBone(pJoints, pJointPoints, JointType_HipLeft, JointType_KneeLeft);
    DrawBone(pJoints, pJointPoints, JointType_KneeLeft, JointType_AnkleLeft);
    DrawBone(pJoints, pJointPoints, JointType_AnkleLeft, JointType_FootLeft);

    // Draw the joints
    for (int i = 0; i < JointType_Count; ++i)
    {
        D2D1_ELLIPSE ellipse = D2D1::Ellipse(pJointPoints[i], c_JointThickness, c_JointThickness);

        if (pJoints[i].TrackingState == TrackingState_Inferred)
        {
            m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
        }
        else if (pJoints[i].TrackingState == TrackingState_Tracked)
        {
            m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
        }
    }
}
Beispiel #4
0
/// <summary>
/// Draws a body 
/// </summary>
/// <param name="pJoints">joint data</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
void testApp::DrawBody(const Joint* pJoints, const ofVec2f* pJointPoints)
{
	// Draw the bones
	ofLogWarning("Draw Body");
	// Torso
	DrawBone(pJoints, pJointPoints, JointType_Head, JointType_Neck);
	DrawBone(pJoints, pJointPoints, JointType_Neck, JointType_SpineShoulder);
	DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_SpineMid);
	DrawBone(pJoints, pJointPoints, JointType_SpineMid, JointType_SpineBase);
	DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderRight);
	DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderLeft);
	DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipRight);
	DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipLeft);

	// Right Arm    
	DrawBone(pJoints, pJointPoints, JointType_ShoulderRight, JointType_ElbowRight);
	DrawBone(pJoints, pJointPoints, JointType_ElbowRight, JointType_WristRight);
	DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_HandRight);
	DrawBone(pJoints, pJointPoints, JointType_HandRight, JointType_HandTipRight);
	DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_ThumbRight);

	// Left Arm
	DrawBone(pJoints, pJointPoints, JointType_ShoulderLeft, JointType_ElbowLeft);
	DrawBone(pJoints, pJointPoints, JointType_ElbowLeft, JointType_WristLeft);
	DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_HandLeft);
	DrawBone(pJoints, pJointPoints, JointType_HandLeft, JointType_HandTipLeft);
	DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_ThumbLeft);

	// Right Leg
	DrawBone(pJoints, pJointPoints, JointType_HipRight, JointType_KneeRight);
	DrawBone(pJoints, pJointPoints, JointType_KneeRight, JointType_AnkleRight);
	DrawBone(pJoints, pJointPoints, JointType_AnkleRight, JointType_FootRight);

	// Left Leg
	DrawBone(pJoints, pJointPoints, JointType_HipLeft, JointType_KneeLeft);
	DrawBone(pJoints, pJointPoints, JointType_KneeLeft, JointType_AnkleLeft);
	DrawBone(pJoints, pJointPoints, JointType_AnkleLeft, JointType_FootLeft);

	// Draw the joints
	for (int i = 0; i < JointType_Count; ++i)
	{

		//ofEllipse ellipse = ofEllipse(pJointPoints[i], c_JointThickness, c_JointThickness);

		if (pJoints[i].TrackingState == TrackingState_Inferred)
		{
			//m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
		}
		else if (pJoints[i].TrackingState == TrackingState_Tracked)
		{
			//m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
		}
	}
}
Beispiel #5
0
/// <summary>
/// Draws a body 
/// </summary>
/// <param name="pJoints">joint data</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
void ImageRenderer::DrawBody(const Joint* pJoints, const D2D1_POINT_2F* pJointPoints)
{
	// Draw the bones

	// Torso
	DrawBone(pJoints, pJointPoints, JointType_Head, JointType_Neck);
	DrawBone(pJoints, pJointPoints, JointType_Neck, JointType_SpineShoulder);
	DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_SpineMid);
	DrawBone(pJoints, pJointPoints, JointType_SpineMid, JointType_SpineBase);
	DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderRight);
	DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderLeft);
	DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipRight);
	DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipLeft);

	// Right Arm    
	DrawBone(pJoints, pJointPoints, JointType_ShoulderRight, JointType_ElbowRight);
	DrawBone(pJoints, pJointPoints, JointType_ElbowRight, JointType_WristRight);
	DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_HandRight);
	DrawBone(pJoints, pJointPoints, JointType_HandRight, JointType_HandTipRight);
	DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_ThumbRight);

	// Left Arm
	DrawBone(pJoints, pJointPoints, JointType_ShoulderLeft, JointType_ElbowLeft);
	DrawBone(pJoints, pJointPoints, JointType_ElbowLeft, JointType_WristLeft);
	DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_HandLeft);
	DrawBone(pJoints, pJointPoints, JointType_HandLeft, JointType_HandTipLeft);
	DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_ThumbLeft);

	// Right Leg
	DrawBone(pJoints, pJointPoints, JointType_HipRight, JointType_KneeRight);
	DrawBone(pJoints, pJointPoints, JointType_KneeRight, JointType_AnkleRight);
	DrawBone(pJoints, pJointPoints, JointType_AnkleRight, JointType_FootRight);

	// Left Leg
	DrawBone(pJoints, pJointPoints, JointType_HipLeft, JointType_KneeLeft);
	DrawBone(pJoints, pJointPoints, JointType_KneeLeft, JointType_AnkleLeft);
	DrawBone(pJoints, pJointPoints, JointType_AnkleLeft, JointType_FootLeft);

	// Draw the joints
	for (int i = 0; i < JointType_Count; ++i)
	{
		D2D1_ELLIPSE ellipse = D2D1::Ellipse(pJointPoints[i], c_JointThickness, c_JointThickness);

		if (pJoints[i].TrackingState == TrackingState_Inferred)
		{
			m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
		}
		else if (pJoints[i].TrackingState == TrackingState_Tracked)
		{
			m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
		}
		
		ellipse.radiusX *= 5.0;
		ellipse.radiusY *= 5.0;

		WCHAR szStatusMessage[64] = { 0 };
		switch (i)
		{
		case JointType_ShoulderLeft:
		case JointType_ShoulderRight:
		case JointType_WristLeft:
		case JointType_WristRight:
			m_pRenderTarget->FillEllipse(ellipse, m_pBrushHandClosed);
			//StringCchPrintf(szStatusMessage, _countof(szStatusMessage),
			//	L"x:%.2f y:%.2f", pJointPoints[i].x, pJointPoints[i].y);

			//m_pRenderTarget->DrawTextW(szStatusMessage, _countof(szStatusMessage), m_pTextFormat,
			//	D2D1::RectF(pJointPoints[i].x + 50.0, pJointPoints[i].y, pJointPoints[i].x + 250.0, pJointPoints[i].y + 100.0), m_pBrushHandOpen);
			break; 
		}
	}
}
Beispiel #6
0
/// Handle new body data
void CBodyBasics::ProcessBody(int nBodyCount, IBody** ppBodies)
{
	//记录操作结果是否成功
	HRESULT hr;

	//对于每一个IBody
	for (int i = 0; i < nBodyCount; ++i)
	{
		IBody* pBody = ppBodies[i];
		if (pBody)//还没有搞明白这里pBody和下面的bTracked有什么区别
		{
			BOOLEAN bTracked = false;
			hr = pBody->get_IsTracked(&bTracked);

			if (SUCCEEDED(hr) && bTracked)
			{
				Joint joints[JointType_Count];//存储关节点类
				HandState leftHandState = HandState_Unknown;//左手状态
				HandState rightHandState = HandState_Unknown;//右手状态

				//获取左右手状态
				pBody->get_HandLeftState(&leftHandState);
				pBody->get_HandRightState(&rightHandState);

				//存储深度坐标系中的关节点位置
				DepthSpacePoint *depthSpacePosition = new DepthSpacePoint[_countof(joints)];

				//获得关节点类
				hr = pBody->GetJoints(_countof(joints), joints);
				if (SUCCEEDED(hr))
				{
					clear = false;
					for (int j = 0; j < _countof(joints); ++j)
					{
						//将关节点坐标从摄像机坐标系(-1~1)转到深度坐标系(424*512)
						m_pCoordinateMapper->MapCameraPointToDepthSpace(joints[j].Position, &depthSpacePosition[j]);
					}
					bodyXY[i][0] = depthSpacePosition[JointType_SpineMid].X;
					bodyXY[i][1] = depthSpacePosition[JointType_SpineMid].Y;
					angle[i]	 = atan(joints[JointType_SpineMid].Position.X / joints[JointType_SpineMid].Position.Z);
					if ( 0 > bodyXY[i][0] || bodyXY[i][0] > 512 || 0 > bodyXY[i][1] || bodyXY[i][1] > 424 )
					{
						bodyXY[i][0] = -1; 
						bodyXY[i][1] = -1; 
					}

					//------------------------hand state left-------------------------------
					DrawHandState(depthSpacePosition[JointType_HandLeft], leftHandState);
					DrawHandState(depthSpacePosition[JointType_HandRight], rightHandState);

					//---------------------------body-------------------------------
					DrawBone(joints, depthSpacePosition, JointType_Head, JointType_Neck);
					DrawBone(joints, depthSpacePosition, JointType_Neck, JointType_SpineShoulder);
					DrawBone(joints, depthSpacePosition, JointType_SpineShoulder, JointType_SpineMid);
					DrawBone(joints, depthSpacePosition, JointType_SpineMid, JointType_SpineBase);
					DrawBone(joints, depthSpacePosition, JointType_SpineShoulder, JointType_ShoulderRight);
					DrawBone(joints, depthSpacePosition, JointType_SpineShoulder, JointType_ShoulderLeft);
					DrawBone(joints, depthSpacePosition, JointType_SpineBase, JointType_HipRight);
					DrawBone(joints, depthSpacePosition, JointType_SpineBase, JointType_HipLeft);

					// -----------------------Right Arm ------------------------------------ 
					DrawBone(joints, depthSpacePosition, JointType_ShoulderRight, JointType_ElbowRight);
					DrawBone(joints, depthSpacePosition, JointType_ElbowRight, JointType_WristRight);
					DrawBone(joints, depthSpacePosition, JointType_WristRight, JointType_HandRight);
					DrawBone(joints, depthSpacePosition, JointType_HandRight, JointType_HandTipRight);
					DrawBone(joints, depthSpacePosition, JointType_WristRight, JointType_ThumbRight);

					//----------------------------------- Left Arm--------------------------
					DrawBone(joints, depthSpacePosition, JointType_ShoulderLeft, JointType_ElbowLeft);
					DrawBone(joints, depthSpacePosition, JointType_ElbowLeft, JointType_WristLeft);
					DrawBone(joints, depthSpacePosition, JointType_WristLeft, JointType_HandLeft);
					DrawBone(joints, depthSpacePosition, JointType_HandLeft, JointType_HandTipLeft);
					DrawBone(joints, depthSpacePosition, JointType_WristLeft, JointType_ThumbLeft);

					// ----------------------------------Right Leg--------------------------------
					DrawBone(joints, depthSpacePosition, JointType_HipRight, JointType_KneeRight);
					DrawBone(joints, depthSpacePosition, JointType_KneeRight, JointType_AnkleRight);
					DrawBone(joints, depthSpacePosition, JointType_AnkleRight, JointType_FootRight);

					// -----------------------------------Left Leg---------------------------------
					DrawBone(joints, depthSpacePosition, JointType_HipLeft, JointType_KneeLeft);
					DrawBone(joints, depthSpacePosition, JointType_KneeLeft, JointType_AnkleLeft);
					DrawBone(joints, depthSpacePosition, JointType_AnkleLeft, JointType_FootLeft);
				}
				delete[] depthSpacePosition;
			}
		}
	}
	cv::imshow("skeletonImg", skeletonImg);
	cv::waitKey(5);
}
/// <summary>
/// Draws a skeleton
/// </summary>
/// <param name="skel">skeleton to draw</param>
/// <param name="windowWidth">width (in pixels) of output buffer</param>
/// <param name="windowHeight">height (in pixels) of output buffer</param>
void CSkeletonBasics::DrawSkeleton(const NUI_SKELETON_DATA & skel, int windowWidth, int windowHeight)
{      
    int i;

    for (i = 0; i < NUI_SKELETON_POSITION_COUNT; ++i)
    {
        m_Points[i] = SkeletonToScreen(skel.SkeletonPositions[i], windowWidth, windowHeight);
    }

    // Render Torso
    DrawBone(skel, NUI_SKELETON_POSITION_HEAD, NUI_SKELETON_POSITION_SHOULDER_CENTER);
    DrawBone(skel, NUI_SKELETON_POSITION_SHOULDER_CENTER, NUI_SKELETON_POSITION_SHOULDER_LEFT);
    DrawBone(skel, NUI_SKELETON_POSITION_SHOULDER_CENTER, NUI_SKELETON_POSITION_SHOULDER_RIGHT);
    DrawBone(skel, NUI_SKELETON_POSITION_SHOULDER_CENTER, NUI_SKELETON_POSITION_SPINE);
    DrawBone(skel, NUI_SKELETON_POSITION_SPINE, NUI_SKELETON_POSITION_HIP_CENTER);
    DrawBone(skel, NUI_SKELETON_POSITION_HIP_CENTER, NUI_SKELETON_POSITION_HIP_LEFT);
    DrawBone(skel, NUI_SKELETON_POSITION_HIP_CENTER, NUI_SKELETON_POSITION_HIP_RIGHT);

    // Left Arm
    DrawBone(skel, NUI_SKELETON_POSITION_SHOULDER_LEFT, NUI_SKELETON_POSITION_ELBOW_LEFT);
    DrawBone(skel, NUI_SKELETON_POSITION_ELBOW_LEFT, NUI_SKELETON_POSITION_WRIST_LEFT);
    DrawBone(skel, NUI_SKELETON_POSITION_WRIST_LEFT, NUI_SKELETON_POSITION_HAND_LEFT);

    // Right Arm
    DrawBone(skel, NUI_SKELETON_POSITION_SHOULDER_RIGHT, NUI_SKELETON_POSITION_ELBOW_RIGHT);
    DrawBone(skel, NUI_SKELETON_POSITION_ELBOW_RIGHT, NUI_SKELETON_POSITION_WRIST_RIGHT);
    DrawBone(skel, NUI_SKELETON_POSITION_WRIST_RIGHT, NUI_SKELETON_POSITION_HAND_RIGHT);

    // Left Leg
    DrawBone(skel, NUI_SKELETON_POSITION_HIP_LEFT, NUI_SKELETON_POSITION_KNEE_LEFT);
    DrawBone(skel, NUI_SKELETON_POSITION_KNEE_LEFT, NUI_SKELETON_POSITION_ANKLE_LEFT);
    DrawBone(skel, NUI_SKELETON_POSITION_ANKLE_LEFT, NUI_SKELETON_POSITION_FOOT_LEFT);

    // Right Leg
    DrawBone(skel, NUI_SKELETON_POSITION_HIP_RIGHT, NUI_SKELETON_POSITION_KNEE_RIGHT);
    DrawBone(skel, NUI_SKELETON_POSITION_KNEE_RIGHT, NUI_SKELETON_POSITION_ANKLE_RIGHT);
    DrawBone(skel, NUI_SKELETON_POSITION_ANKLE_RIGHT, NUI_SKELETON_POSITION_FOOT_RIGHT);
    
    // Draw the joints in a different color
    for (i = 0; i < NUI_SKELETON_POSITION_COUNT; ++i)
    {
        D2D1_ELLIPSE ellipse = D2D1::Ellipse( m_Points[i], g_JointThickness, g_JointThickness );

        if ( skel.eSkeletonPositionTrackingState[i] == NUI_SKELETON_POSITION_INFERRED )
        {
            m_pRenderTarget->DrawEllipse(ellipse, m_pBrushJointInferred);
        }
        else if ( skel.eSkeletonPositionTrackingState[i] == NUI_SKELETON_POSITION_TRACKED )
        {
            m_pRenderTarget->DrawEllipse(ellipse, m_pBrushJointTracked);
        }
    }
}
Beispiel #8
0
void Esp()
{
	if (!Targets.empty())
	{
		vec4_t clEnemyVIS = { cFuncESPEnemyVISR.iValue/255.0f, cFuncESPEnemyVISG.iValue/255.0f, cFuncESPEnemyVISB.iValue/255.0f, 1.0f };
		vec4_t clEnemyINVIS = { cFuncESPEnemyUNVISR.iValue/255.0f, cFuncESPEnemyUNVISG.iValue/255.0f, cFuncESPEnemyUNVISB.iValue/255.0f, 1.0f };
		vec4_t clFriendyVIS = { cFuncESPFriendVISR.iValue/255.0f, cFuncESPFriendVISG.iValue/255.0f, cFuncESPFriendVISB.iValue/255.0f, 1.0f };
		vec4_t clFriendINVIS = { cFuncESPFriendUNVISR.iValue/255.0f, cFuncESPFriendUNVISG.iValue/255.0f, cFuncESPFriendUNVISB.iValue/255.0f, 1.0f };
		
		for (int i = 0; i < Targets.size(); i++)
		{
			if (!Targets[i].alive || (Targets[i].enemy && cFuncESPFilter.iValue == FILTR_ESPFRIENDS) || 
				(!Targets[i].enemy && cFuncESPFilter.iValue == FILTR_ESPENEMY) || (bot.cg->snap->ps.clientNum == Targets[i].ci->clientNum))
				continue;

			vec4_t colour;
			if (Targets[i].enemy)
			{
				if (Targets[i].visible)
					CopyVec4(colour, clEnemyVIS);
				else
					CopyVec4(colour, clEnemyINVIS);
			}
			else {
				if (Targets[i].visible)
					CopyVec4(colour, clFriendyVIS);
				else
					CopyVec4(colour, clFriendINVIS);
			}

			float	fov_x	= *(float*)((DWORD)GetModuleHandleA("gfx_d3d_mp_x86_s.dll") + bot.Fov_x);

			if (cFuncESP3Dbox.bValue)
			{
				Draw3DBox(Targets[i], colour);
			}

			if (cFuncESP2Dbox.bValue)
			{
				vec3_t orgUP, orgDown;
				vec2_t crdUP, crdDown;
				GetBoneOriginID(Targets[i].cent, "j_helmet", orgUP);
				CopyVec3(orgDown, Targets[i].cent->lerpOrigin);
				if (WorldToScreen(orgUP, crdUP) && WorldToScreen(orgDown, crdDown))
				{
					float width = 400.0f;
					float x = crdDown[0]-((width / Targets[i].distance * fov_x)/2);
					float y = crdUP[1];
					float w = (width / Targets[i].distance * fov_x);
					float h = crdDown[1] - crdUP[1];
					Draw.Border(x, y, w, h, 2, colour);
				}
			}

			if (cFuncESPSkeleton.bValue)
			{
				DrawBone(Targets[i].cent, "j_head_end", "j_head", colour);
				DrawBone(Targets[i].cent, "j_head", "j_neck", colour);
				DrawBone(Targets[i].cent, "j_neck", "j_clavicle_le", colour);
				DrawBone(Targets[i].cent, "j_neck", "j_clavicle_ri", colour);

				DrawBone(Targets[i].cent, "j_clavicle_le", "j_shoulder_le", colour);
				DrawBone(Targets[i].cent, "j_shoulder_le", "j_elbow_le", colour);
				DrawBone(Targets[i].cent, "j_elbow_le", "j_wrist_le", colour);

				DrawBone(Targets[i].cent, "j_clavicle_ri", "j_shoulder_ri", colour);
				DrawBone(Targets[i].cent, "j_shoulder_ri", "j_elbow_ri", colour);
				DrawBone(Targets[i].cent, "j_elbow_ri", "j_wrist_ri", colour);

				DrawBone(Targets[i].cent, "j_neck", "j_spine4", colour);
				DrawBone(Targets[i].cent, "j_spine4", "j_spine3", colour);
				DrawBone(Targets[i].cent, "j_spine3", "j_spine2", colour);
				DrawBone(Targets[i].cent, "j_spine2", "j_spine1", colour);
				DrawBone(Targets[i].cent, "j_spine1", "torso_stabilizer", colour);

				DrawBone(Targets[i].cent, "torso_stabilizer", "j_hiptwist_le", colour);
				DrawBone(Targets[i].cent, "j_hiptwist_le", "j_knee_le", colour);
				DrawBone(Targets[i].cent, "j_knee_le", "j_ankle_le", colour);
				DrawBone(Targets[i].cent, "j_ankle_le", "j_ball_le", colour);

				DrawBone(Targets[i].cent, "torso_stabilizer", "j_hiptwist_ri", colour);
				DrawBone(Targets[i].cent, "j_hiptwist_ri", "j_knee_ri", colour);
				DrawBone(Targets[i].cent, "j_knee_ri", "j_ankle_ri", colour);
				DrawBone(Targets[i].cent, "j_ankle_ri", "j_ball_ri", colour);
			}

			if (cFuncESPLines.bValue)
			{
				vec2_t screen;
				vec3_t org;
				GetBoneOriginID(Targets[i].cent, "j_spine1", org);
				if(WorldToScreen(org, screen))
				{
					float x = bot.cg->refdef.width/2;
					float y = bot.cg->refdef.height;
					Draw.Line(x, y, screen[0], screen[1], colour, 1);
				}
			}

			LPSTR font;
			switch (cFuncESPFont.iValue)
			{
			case FILTR_BIG:
				font = bot.fonts.Big;
				break;
			case FILTR_NORMAL:
				font = bot.fonts.Normal;
				break;
			case FILTR_SMALL:
				font = bot.fonts.Small;
				break;
			case FILTR_BOLD:
				font = bot.fonts.Bold;
			default:
				font = bot.fonts.Big;
				break;
			}

			vec3_t org_helmet; vec2_t screen1, screen2;
			GetBoneOriginID(Targets[i].cent, "j_helmet", org_helmet);
			if(WorldToScreen(org_helmet, screen1) && WorldToScreen(Targets[i].cent->lerpOrigin, screen2))
			{
				string name = strip_color(string(Targets[i].ci->name));
				name = strip_color(name);

				if (cFuncESPNames.bValue)
					Draw.Text(screen1[0], screen1[1], 0.8, colour, F_CENTER, font, "%s", name.c_str());
				if (cFuncESPDistance.bValue)
					Draw.Text(screen2[0], screen2[1], 0.9, colour, F_CENTER, font, "%im", (int)Targets[i].distance);
			}
		}
	}
}
Beispiel #9
0
/// <summary>
/// Draws all the body to the associated hwnd, assumes that BeginDraw has been called
/// </summary>
/// <param name="body">body to be drawn</param>
void ImageRenderer::DrawBody(Body &body)
{
	// Draw the bones

	// Torso
	DrawBone(body, JointType_Head, JointType_Neck);
	DrawBone(body, JointType_Neck, JointType_SpineShoulder);
	DrawBone(body, JointType_SpineShoulder, JointType_SpineMid);
	DrawBone(body, JointType_SpineMid, JointType_SpineBase);
	DrawBone(body, JointType_SpineShoulder, JointType_ShoulderRight);
	DrawBone(body, JointType_SpineShoulder, JointType_ShoulderLeft);
	DrawBone(body, JointType_SpineBase, JointType_HipRight);
	DrawBone(body, JointType_SpineBase, JointType_HipLeft);

	// Right Arm    
	DrawBone(body, JointType_ShoulderRight, JointType_ElbowRight);
	DrawBone(body, JointType_ElbowRight, JointType_WristRight);
	DrawBone(body, JointType_WristRight, JointType_HandRight);
	DrawBone(body, JointType_HandRight, JointType_HandTipRight);
	DrawBone(body, JointType_WristRight, JointType_ThumbRight);

	// Left Arm
	DrawBone(body, JointType_ShoulderLeft, JointType_ElbowLeft);
	DrawBone(body, JointType_ElbowLeft, JointType_WristLeft);
	DrawBone(body, JointType_WristLeft, JointType_HandLeft);
	DrawBone(body, JointType_HandLeft, JointType_HandTipLeft);
	DrawBone(body, JointType_WristLeft, JointType_ThumbLeft);

	// Right Leg
	DrawBone(body, JointType_HipRight, JointType_KneeRight);
	DrawBone(body, JointType_KneeRight, JointType_AnkleRight);
	DrawBone(body, JointType_AnkleRight, JointType_FootRight);

	// Left Leg
	DrawBone(body, JointType_HipLeft, JointType_KneeLeft);
	DrawBone(body, JointType_KneeLeft, JointType_AnkleLeft);
	DrawBone(body, JointType_AnkleLeft, JointType_FootLeft);

	for (unsigned int i = 0; i < body.vJoints.size(); i++)
	{
		D2D1_POINT_2F tempPoint;
		tempPoint.x = body.vJointsInColorSpace[i].X;
		tempPoint.y = body.vJointsInColorSpace[i].Y;

		D2D1_ELLIPSE ellipse = D2D1::Ellipse(tempPoint, 6.0f, 6.0f);

		if (body.vJoints[i].TrackingState == TrackingState_Inferred)
		{
			m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
		}
		else if (body.vJoints[i].TrackingState == TrackingState_Tracked)
		{
			m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
		}
	}
}
/// <summary>
/// Draws a body 
/// </summary>
/// <param name="pJoints">joint data</param>
/// <param name="pJointPoints">joint positions converted to screen space</param>
void CBodyBasics::DrawBody(const Joint* pJoints, const D2D1_POINT_2F* pJointPoints)
{
    // Draw the bones

    // Torso
    DrawBone(pJoints, pJointPoints, JointType_Head, JointType_Neck);
    DrawBone(pJoints, pJointPoints, JointType_Neck, JointType_SpineShoulder);
    DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_SpineMid);
    DrawBone(pJoints, pJointPoints, JointType_SpineMid, JointType_SpineBase);
    DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderRight);
    DrawBone(pJoints, pJointPoints, JointType_SpineShoulder, JointType_ShoulderLeft);
    DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipRight);
    DrawBone(pJoints, pJointPoints, JointType_SpineBase, JointType_HipLeft);
    
    // Right Arm    
    DrawBone(pJoints, pJointPoints, JointType_ShoulderRight, JointType_ElbowRight);
    DrawBone(pJoints, pJointPoints, JointType_ElbowRight, JointType_WristRight);
    DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_HandRight);
    DrawBone(pJoints, pJointPoints, JointType_HandRight, JointType_HandTipRight);
    DrawBone(pJoints, pJointPoints, JointType_WristRight, JointType_ThumbRight);

    // Left Arm
    DrawBone(pJoints, pJointPoints, JointType_ShoulderLeft, JointType_ElbowLeft);
    DrawBone(pJoints, pJointPoints, JointType_ElbowLeft, JointType_WristLeft);
    DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_HandLeft);
    DrawBone(pJoints, pJointPoints, JointType_HandLeft, JointType_HandTipLeft);
    DrawBone(pJoints, pJointPoints, JointType_WristLeft, JointType_ThumbLeft);

    // Right Leg
    DrawBone(pJoints, pJointPoints, JointType_HipRight, JointType_KneeRight);
    DrawBone(pJoints, pJointPoints, JointType_KneeRight, JointType_AnkleRight);
    DrawBone(pJoints, pJointPoints, JointType_AnkleRight, JointType_FootRight);

    // Left Leg
    DrawBone(pJoints, pJointPoints, JointType_HipLeft, JointType_KneeLeft);
    DrawBone(pJoints, pJointPoints, JointType_KneeLeft, JointType_AnkleLeft);
    DrawBone(pJoints, pJointPoints, JointType_AnkleLeft, JointType_FootLeft);

    // Draw the joints
    for (int i = 0; i < JointType_Count; ++i)
    {
        D2D1_ELLIPSE ellipse = D2D1::Ellipse(pJointPoints[i], c_JointThickness, c_JointThickness);

        if (pJoints[i].TrackingState == TrackingState_Inferred)
        {
            m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointInferred);
        }
        else if (pJoints[i].TrackingState == TrackingState_Tracked)
        {
            m_pRenderTarget->FillEllipse(ellipse, m_pBrushJointTracked);
        }
    }
	
	if(frameCount % 10000000 == 0){
		float rightShHaX = pJointPoints[JointType_ShoulderRight].x - pJointPoints[JointType_HandRight].x;
		float rightShHaY = pJointPoints[JointType_ShoulderRight].y - pJointPoints[JointType_HandRight].y;
		float leftShHaX = pJointPoints[JointType_ShoulderLeft].x - pJointPoints[JointType_HandLeft].x;
		float leftShHaY = pJointPoints[JointType_ShoulderLeft].y - pJointPoints[JointType_HandLeft].y;
	
		float rightShElX = pJointPoints[JointType_ShoulderRight].x - pJointPoints[JointType_ElbowRight].x;
		float rightShElY = pJointPoints[JointType_ShoulderRight].y - pJointPoints[JointType_ElbowRight].y;
		float leftShElX = pJointPoints[JointType_ShoulderLeft].x - pJointPoints[JointType_ElbowLeft].x;
		float leftShElY = pJointPoints[JointType_ShoulderLeft].y - pJointPoints[JointType_ElbowLeft].y;

		float rightElHaX = pJointPoints[JointType_ElbowRight].x - pJointPoints[JointType_HandRight].x;
		float rightElHaY = pJointPoints[JointType_ElbowRight].y - pJointPoints[JointType_HandRight].y;
		float leftElHaX = pJointPoints[JointType_ElbowLeft].x - pJointPoints[JointType_HandLeft].x;
		float leftElHaY = pJointPoints[JointType_ElbowLeft].y - pJointPoints[JointType_HandLeft].y;

		float ShHe = pJointPoints[JointType_SpineShoulder].x - pJointPoints[JointType_Head].x;

		IDWriteTextFormat* m_pTextFormat;
		ID2D1SolidColorBrush *m_pBlackBrush;
		m_pRenderTarget->CreateSolidColorBrush(
			D2D1::ColorF(D2D1::ColorF::Black, 1.0f),
			&m_pBlackBrush
			);
		//m_pTextFormat = new CD2DTextFormat(GetRenderTarget(), _T("Arial"), 96);
		//m_pRenderTarget->DrawTextW(L"hello",
		//	ARRAYSIZE("hello") - 1,
		//	m_pTextFormat,
		//	D2D1::RectF(0, 0, 500, 500),
		//	m_pBlackBrush);
		wchar_t buf[1024];
		if (isWrite) {
			_snwprintf_s(buf, 1024, _TRUNCATE, L"%d\n", 1);
		}
		else {
			_snwprintf_s(buf, 1024, _TRUNCATE, L"%d\n", 0);
		}
		OutputDebugString(buf);
		isWrite = true;
		if (isWrite) {
			if (IS_UP_SLANTING(rightShHaY) && IS_HORIZON(leftShHaX)) { //h1
				OutputDebugString(L"h1\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add h1 h1");
			}

			if (IS_HORIZON(rightShHaY) && IS_VERTICAL(leftShHaX) ) { //h2
				OutputDebugString(L"h2\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add h2 h2");
			}

			if (IS_DOWN_SLANTING(rightShHaY) && IS_VERTICAL(leftShHaX) ) { //h3
				OutputDebugString(L"h3\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add h3 h3");
			}

			if (IS_UP_SLANTING(rightShHaY) &&  IS_UP_SLANTING(leftShHaX) ) { //title
				OutputDebugString(L"title\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add title title");
			}

			if (IS_DOWN_SLANTING(rightShHaY) && IS_DOWN_SLANTING(leftShHaX)) { //img
				OutputDebugString(L"img\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add img img");
			}

			if (IS_UP_SLANTING(rightShHaY) &&  IS_DOWN_SLANTING(leftShHaX)) { //ul
				OutputDebugString(L"ul\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add ul 3");
			}

			if (IS_DOWN_SLANTING(rightShHaY) && IS_UP_SLANTING(leftShHaX)) { //ol
				OutputDebugString(L"ol\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add ol 3");
			}

			//if (IS_VERTICAL(rightShElY) && rightShElY > 0 && IS_HORIZON(rightElHaX) && IS_VERTICAL(leftShElY) && leftShElY > 0 && IS_HORIZON(leftElHaX)) { //font
			//	OutputDebugString(L"font\n");
			//	system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add font font");
			//}

			//if (IS_VERTICAL(leftShElX) && IS_HORIZON(leftElHaY) && IS_VERTICAL(rightShElX) && IS_HORIZON(rightElHaY)) { //u
			//	OutputDebugString(L"u\n");
			//	system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add u u");
			//}

			//if (IS_HORIZON(leftShElY) && IS_VERTICAL(leftElHaX) && leftElHaY > 0 && IS_HORIZON(rightShElY) && IS_VERTICAL(rightElHaX) && rightElHaY < 0) { //B
			//	OutputDebugString(L"B\n");
			//	system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add B B");
			//}

			//if (IS_UP_SLANTING(leftShHaX) && IS_VERTICAL(rightShHaX)) { //i
			//	OutputDebugString(L"i\n");
			//	system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add i i");
			//}

			if (IS_HORIZON(leftShHaY) && IS_HORIZON(rightShHaY) && !IS_VERTICAL(leftShHaX) && !IS_VERTICAL(rightShHaX)) { //p
				OutputDebugString(L"p\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add p p");
			}

			if (IS_VERTICAL(rightShElY) && IS_HORIZON(rightElHaX) && IS_VERTICAL(leftShElY) && IS_HORIZON(leftElHaX)) { //table
				OutputDebugString(L"table\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add table 3 3 ");
			}

			//if (IS_HORIZON(leftShHaY) && IS_VERTICAL(rightShHaX) && !IS_VERTICAL(ShHe)) { //tr
			//	OutputDebugString(L"tr\n");
			//	system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb add tr tr");
			//}
			if (!IS_VERTICAL(ShHe)&& IS_VERTICAL(rightShHaX) && IS_VERTICAL(leftShHaX) && IS_HORIZON(rightElHaX) && IS_HORIZON(leftElHaX)) {
				OutputDebugString(L"undo\n");
				system("ruby C:\\Users\\tuchiyama\\Documents\\odorimming\\make_html.rb undo");
			}
		}
	}
}