void RouteMapOverlay::RenderIsoRoute(IsoRoute *r, wxColour &grib_color, wxColour &climatology_color,
                                     wrDC &dc, PlugIn_ViewPort &vp)
{
    SkipPosition *s = r->skippoints;
    if(!s)
        return;

    wxColour grib_deficient_color = TransparentColor(grib_color);
    wxColour climatology_deficient_color = TransparentColor(climatology_color);

    Position *p = s->point;
    wxColour *pcolor = &PositionColor(p, grib_color, climatology_color,
                                      grib_deficient_color, climatology_deficient_color);
    if(!dc.GetDC())
        glBegin(GL_LINES);
    do {
        wxColour &ncolor = PositionColor(p->next, grib_color, climatology_color,
                                         grib_deficient_color, climatology_deficient_color);
        if(!p->copied || !p->next->copied)
            DrawLine(p, *pcolor, p->next, ncolor, dc, vp);
        pcolor = &ncolor;
        p = p->next;
    } while(p != s->point);
    if(!dc.GetDC())
        glEnd();

    /* now render any children */
    wxColour cyan(0, 255, 255), magenta(255, 0, 255);
    for(IsoRouteList::iterator it = r->children.begin(); it != r->children.end(); ++it)
        RenderIsoRoute(*it, cyan, magenta, dc, vp);
}
예제 #2
0
LightRectangleNode* LightRectangleNode::create(const Vec3& position, const Size& size, const Color4& color /* = Color4(1.0f,1.0f,1.0f,1.0f) */)
{
	PositionColor array[4] = 	{ 	
									PositionColor( Vec3(-size.x / 2 + position.x,  size.y / 2 + position.y, position.z), color),
									PositionColor( Vec3(-size.x / 2 + position.x, -size.y / 2 + position.y, position.z), color),
									PositionColor( Vec3( size.x / 2 + position.x,  size.y / 2 + position.y, position.z), color),
									PositionColor( Vec3( size.x / 2 + position.x, -size.y / 2 + position.y, position.z), color)
								};

	auto node = new (std::nothrow) LightRectangleNode(array, 4);
	if (not node)
	{
		return nullptr;
	}

	node->m_position = position;
	node->m_size = size;
	node->m_color = color;

	return node;
}
예제 #3
0
파일: scene.cpp 프로젝트: julianbrummer/mv2
Model::Model(const aligned_vector3f &positions, const aligned_vector3f &colors, bool centerAndScale, int mode, float size)
        : SceneObject(), mode(mode), positions(positions) {
    aligned_vectorPosColor posAndColors;
    for (uint i = 0; i < positions.size(); ++i) {
        posAndColors.push_back(PositionColor(positions[i], colors[i]));
    }
    VBOInfo posColor(0,-1,sizeof(Vector3f));
    vbo = shared_ptr<VBO>(new VBO(posAndColors, posColor, GL_STATIC_DRAW));
    if (centerAndScale)
        init(size);
    else {
        center.setZero(3);
        scale = 1.0;
    }
}
예제 #4
0
	void PrimitiveCube::init_color_vi_buffers()
	{
		const std::array<PositionColor, COLOR_VERT_COUNT> vTemp =
		{
			PositionColor(-1.0f, 1.0f, 1.0f,
			   Colors::Red.r, Colors::Red.g, Colors::Red.b, Colors::Red.a),
			PositionColor(1.0f, 1.0f, 1.0f,
			   Colors::Blue.r, Colors::Blue.g, Colors::Blue.b, Colors::Blue.a),
			PositionColor(-1.0f, -1.0f, 1.0f,
			   Colors::Yellow.r, Colors::Yellow.g, Colors::Yellow.b, Colors::Yellow.a),
			PositionColor(1.0f, -1.0f, 1.0f,
			   Colors::Pink.r, Colors::Pink.g, Colors::Pink.b, Colors::Pink.a),

			PositionColor(1.0f, 1.0f, -1.0f,
			   Colors::Green.r, Colors::Green.g, Colors::Green.b, Colors::Green.a),
			PositionColor(-1.0f, 1.0f, -1.0f,
			   Colors::Orange.r, Colors::Orange.g, Colors::Orange.b, Colors::Orange.a),
			PositionColor(1.0, -1.0f, -1.0f,
			   Colors::Aqua.r, Colors::Aqua.g, Colors::Aqua.b, Colors::Aqua.a),
			PositionColor(-1.0f, -1.0f, -1.0f,
			   Colors::Purple.r, Colors::Purple.g, Colors::Purple.b, Colors::Purple.a)
		};
		m_vBuffer->set(0, COLOR_VERT_COUNT, vTemp.data());

		const std::array<unsigned short, COLOR_INDEX_COUNT> iTemp =
		{
			//FRONT FACE
			0, 1, 3, 2,

			//BACK FACE
			4, 5, 7, 6,

			//LEFT FACE
			5, 0, 2, 7,

			//RIGHT FACE
			1, 4, 6, 3,

			//TOP FACE
			5, 4, 1, 0,

			//BOTTOM FACE
			6, 7, 2, 3
		};
		m_iBuffer->set(0, COLOR_INDEX_COUNT, iTemp.data());
	}
예제 #5
0
void WriteNode(FILE *fp, POSITION node, int level, EDGELIST *tree) {
	OPEN_POS_DATA pdata;
	REMOTENESS nodeRemoteness;
	char label[50];

	if(kLoopy && gUseOpen) {
		pdata = GetOpenData(node);
	} else {
		pdata = 0;
	}

	if(!Visited(node)) {
		if(level != GetLevelNumber(pdata)) {
			fprintf(fp, "\t\tsubgraph cluster%llu {\n", node);
			fprintf(fp, "\t\t\tlabel = \" \"\n");
			fprintf(fp, "\t\t\tcolor = \"blue\"\n\t");
			sprintf(label, "\\nlvl %d", GetLevelNumber(pdata));
		} else {
			sprintf(label, " ");
		}

		if(node == gInitialPosition) {
			if(level == GetLevelNumber(pdata)) {
				fprintf(fp, "\t\tsubgraph cluster%llu {\n", node);
				fprintf(fp, "\t\t\tcolor = \"blue\"\n\t");
			}
			fprintf(fp, "%slabel = \"Initial Position\"\n\t", (level == GetLevelNumber(pdata)) ? "\t\t\t" : "\t\t");
		}

		if(GetLevelNumber(pdata) == 0) {
			MarkAsVisited(node);
			fprintf(fp, "\t\t%llu [color = \"%s\", style = \"filled\", shape = \"%s\", label = \"%llu%s\"]", node, PositionColor(node), PositionShape(node), node, label);
		} else if(GetLevelNumber(pdata) > 0) {
			MarkAsVisited(node);
			fprintf(fp, "\t\t%llu [color = \"%s\", style = \"filled\", peripheries = %d, shape = \"%s\", label = \"%llu%s\"]", node, PositionColor(node), GetCorruptionLevel(pdata) + 1, PositionShape(node), node, label);
		} else {
			BadElse("WriteNode");
		}

		if(level != GetLevelNumber(pdata) || node == gInitialPosition) {
			fprintf(fp, "\n\t\t}\n");
		} else {
			fprintf(fp, "\n");
		}

		/* Determine rank of node */
		if(GetLevelNumber(pdata) == 0) {
			nodeRemoteness = Remoteness(node);
		} else {
			nodeRemoteness = GetFremoteness(pdata);
		}

		//0-REMOTENESS_MAX-1 regular nodes,
		//REMOTENESS_MAX level above current level,
		//REMOTENESS_MAX+1 level below current level
		if(gRemotenessOrder) {
			if(level == GetLevelNumber(pdata)) {
				if(GetFringe(pdata)) {
					UpdateRankList(tree, node, REMOTENESS_MAX+1); // want fringes at bottom
				} else {
					UpdateRankList(tree, node, nodeRemoteness);
				}
			} else if(level > GetLevelNumber(pdata)) {
				UpdateRankList(tree, node, REMOTENESS_MAX+1);
			} else if(level < GetLevelNumber(pdata)) {
				UpdateRankList(tree, node, REMOTENESS_MAX);
			} else {
				BadElse("WriteNode");
			}
		}
	}
}
	void PrimitiveTube::init_color_vi_buffers()
	{
		m_topVerts.clear();
		m_botVerts.clear();
		m_inBodyVerts.clear();
		m_outBodyVerts.clear();

		const float ri = m_inRadius;
		const float ro = m_outRadius;
		const float h = 1.0f;
		const float min_sub = 3;
		const float max_sub = 12;
		const float a = TWO_PI / (m_subdivisions + (min_sub-1));

		////TOP CAP VERTS
		for(float i = 0; i <= TWO_PI; i += a)
		{
			m_topVerts.push_back(PositionColor(ri*cos(i), h, ri*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
			m_topVerts.push_back(PositionColor(ro*cos(i), h, ro*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
		}

		m_topVerts.push_back(PositionColor(ri, h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
		m_topVerts.push_back(PositionColor(ro, h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
		


		//BOTTOM CAP VERTS
		for(float i = 0; i <= TWO_PI; i += a)
		{
			m_botVerts.push_back(PositionColor(ri*cos(i), -h, ri*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
			m_botVerts.push_back(PositionColor(ro*cos(i), -h, ro*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
		}

		m_botVerts.push_back(PositionColor(ri, -h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
		m_botVerts.push_back(PositionColor(ro, -h, 0, 1.0f, 0.0f, 0.0f, 1.0f));

		//MIDDLE
		for(float i = 0; i <= TWO_PI; i += a)
		{
			m_inBodyVerts.push_back(PositionColor(ri*cos(i), -h, ri*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
			m_inBodyVerts.push_back(PositionColor(ri*cos(i), h, ri*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
		}

		m_inBodyVerts.push_back(PositionColor(ri, -h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
		m_inBodyVerts.push_back(PositionColor(ri, h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
	
		for(float i = 0; i <= TWO_PI; i += a)
		{
			m_outBodyVerts.push_back(PositionColor(ro*cos(i), -h, ro*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
			m_outBodyVerts.push_back(PositionColor(ro*cos(i), h, ro*sin(i), 1.0f, 0.0f, 0.0f, 1.0f));
		}

		m_outBodyVerts.push_back(PositionColor(ro, -h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
		m_outBodyVerts.push_back(PositionColor(ro, h, 0, 1.0f, 0.0f, 0.0f, 1.0f));
	}