void areaLightNode::draw(M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status)
{

	MColor drawColor;

	drawColor.set(MColor::kRGB,1,1,0,0.5);

	if (status==M3dView::kDormant)
	{
		drawColor.set(MColor::kRGB,1,0,0,0.5);
	}

	view.setDrawColor(drawColor);
	view.beginGL();
	glBegin(GL_LINES);
	    //these are useful
	    glVertex3f(-1.0f,-1.0f,0.0f);
		glVertex3f(-1.0f,1.0f,0.0f);

		glVertex3f(-1.0f,1.0f,0.0f);
		glVertex3f(1.0f,1.0f,0.0f);

		glVertex3f(1.0f,1.0f,0.0f);
		glVertex3f(1.0f,-1.0f,0.0f);

		glVertex3f(1.0f,-1.0f,0.0f);
		glVertex3f(-1.0f,-1.0f,0.0f);

		glVertex3f(0.0f,0.0f,0.0f);
		glVertex3f(0.0f,0.0f,-3.0f);

		glVertex3f(0.0f,0.0f,-3.0f);
		glVertex3f(0.0f,-0.1f,-2.8f);

		glVertex3f(0.0f,0.0f,-3.0f);
		glVertex3f(0.0f,0.1f,-2.8f);

		//these just for fun......
		glVertex3f(-0.3f,0.5f,0.0f);
		glVertex3f(-0.85f,-0.3f,0.0f);

		glVertex3f(0.3f,0.5f,0.0f);
		glVertex3f(0.85f,-0.3f,0.0f);

		glVertex3f(-0.4f,-1.0f,0.0f);
		glVertex3f(-0.4f,-0.2f,0.0f);

		glVertex3f(-0.4f,-0.2f,0.0f);
		glVertex3f(0.4f,-0.2f,0.0f);

		glVertex3f(0.4f,-0.2f,0.0f);
		glVertex3f(0.4f,-1.0f,0.0f);

	glEnd();
	view.endGL();

}
//MStatus pointLightNode::compute(const MPlug &plug, MDataBlock &data)
//{
//	MStatus stat;
//	return stat=MStatus::kSuccess;
//}
void pointLightNode::draw(M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status)
{
	MColor drawColor;

	drawColor.set(MColor::kRGB,1,1,0);

	if (status==M3dView::kDormant)
	{
		drawColor.set(MColor::kRGB,1,0,0);
	}
	if (status==M3dView::kTemplate)
	{
		drawColor.set(MColor::kRGB,0,1,0);
	}
	view.setDrawColor(drawColor);
	view.beginGL();
	glBegin(GL_LINES);
	                        glVertex3f(0.0f,0.1f,0.0f);
		                    glVertex3f(0.1f,0.0f,0.0f);

							glVertex3f(0.0f,0.1f,0.0f);
		                    glVertex3f(-0.1f,0.0f,0.0f);

							glVertex3f(0.0f,0.1f,0.0f);
		                    glVertex3f(0.0f,0.0f,0.1f);

							glVertex3f(0.0f,0.1f,0.0f);
		                    glVertex3f(0.0f,0.0f,-0.1f);

							glVertex3f(0.0f,-0.1f,0.0f);
		                    glVertex3f(0.1f,0.0f,0.0f);

							glVertex3f(0.0f,-0.1f,0.0f);
		                    glVertex3f(-0.1f,0.0f,0.0f);

							glVertex3f(0.0f,-0.1f,0.0f);
		                    glVertex3f(0.0f,0.0f,0.1f);

							glVertex3f(0.0f,-0.1f,0.0f);
		                    glVertex3f(0.0f,0.0f,-0.1f);

							glVertex3f(-0.1f,0.0f,0.0f);
		                    glVertex3f(0.0f,0.0f,0.1f);

							glVertex3f(0.0f,0.0f,0.1f);
		                    glVertex3f(0.1f,0.0f,0.0f);

							glVertex3f(0.1f,0.0f,0.0f);
		                    glVertex3f(0.0f,0.0f,-0.1f);

							glVertex3f(0.0f,0.0f,-0.1f);
		                    glVertex3f(-0.1f,0.0f,0.0f);


    glEnd();
	view.endGL();
}
Beispiel #3
0
    void RegisterScript(MScriptContext* script)
    {
	script->addFunction("RendererAddQuad", ScriptAddQuad);
	script->addFunction("RendererSetColour", ScriptSetColour);

	g_Cnt = 0;
	g_CurrentColour.set(255, 255, 255, 255);
    }
Beispiel #4
0
    void Flush()
    {
	g_CurrentColour.set(255, 255, 255, 255);
	if(g_Cnt == 0) return;

	MEngine* engine = MEngine::getInstance();
	MRenderingContext* render = engine->getRenderingContext();
	MSystemContext* system = engine->getSystemContext();
	
	unsigned int w, h;
	system->getScreenSize(&w, &h);
	
	// set up the "camera"
	render->setViewport(0, 0, w, h);
	render->setMatrixMode(M_MATRIX_PROJECTION);
	render->loadIdentity();
	render->setOrthoView(0, w, h, 0, 1.0f, -1.0f);
	render->setMatrixMode(M_MATRIX_MODELVIEW);
	render->loadIdentity();

	// set up arrays
	render->enableVertexArray();
	render->enableTexCoordArray();
	render->enableColorArray();

	render->setVertexPointer(M_FLOAT, 3, g_Vertices);
	render->setTexCoordPointer(M_FLOAT, 2, g_UVs);
	render->setColorPointer(M_UBYTE, 4, g_Colours);

	render->disableCullFace();
	render->disableDepthTest();

	render->drawArray(M_PRIMITIVE_TRIANGLES, 0, g_Cnt * 6);

	g_Cnt = 0;

	g_Selected = NULL;
    }
void sphereLightNode::draw(M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status)
{
	MFnDagNode sphereFn(thisMObject());
	MPlug radiusPlug=sphereFn.findPlug(sphereRadius);
	float radius;
	radiusPlug.getValue(radius);

	MColor drawColor;

	drawColor.set(MColor::kRGB,1,1,0);

	if (status==M3dView::kDormant)
	{
		drawColor.set(MColor::kRGB,1,0,0);
	}
	if (status==M3dView::kTemplate)
	{
		drawColor.set(MColor::kRGB,0,1,0);
	}
	view.setDrawColor(drawColor);
	MFloatVectorArray points(36);
	for (int i=0; i<36; i++)
	{
		float sphereArc=i*10*PI/180;
		points[i].x=radius*sin(sphereArc);
		points[i].y=radius*cos(sphereArc);
		points[i].z=0.0;
	}
	view.beginGL();
	glBegin(GL_LINE_LOOP);
	    for(int i=0;i<36;i++)
		{
			glVertex3f(points[i].x,points[i].y,0.0);
		}
	glEnd();

	glBegin(GL_LINE_LOOP);
	for(int i=0;i<36;i++)
	{
		glVertex3f(points[i].x,(points[i].y)*cos(60*PI/180),(points[i].y)*sin(60*PI/180));
	}
	glEnd();

	glBegin(GL_LINE_LOOP);
	for(int i=0;i<36;i++)
	{
		glVertex3f(points[i].x,(points[i].y)*cos(60*PI/180),-(points[i].y)*sin(60*PI/180));
	}
	glEnd();

	glBegin(GL_LINE_LOOP);
	for(int i=0;i<36;i++)
	{
		glVertex3f((points[i].x)*sin(60*PI/180),points[i].y,(points[i].x)*cos(60*PI/180));
	}
	glBegin(GL_LINE_LOOP);
	for(int i=0;i<36;i++)
	{
		glVertex3f(-(points[i].x)*sin(60*PI/180),points[i].y,(points[i].x)*cos(60*PI/180));
	}
	glEnd();

	view.endGL();



}