예제 #1
0
파일: block.c 프로젝트: rvba/minuit
t_block *block_copy(t_block *block)
{
	t_context *C=ctx_get();
	scene_store(C->scene,1);

	t_node *clone_node = block_make(block->id.name,block->type);
	t_block *clone_block = clone_node->data;

	clone_block->block_state.draw_outline = block->block_state.draw_outline;

	_add_block(C,clone_block);

	vcp(clone_block->pos,block->pos);

	t_link *l;
	t_brick *b;

	for(l=block->bricks->first;l;l=l->next)
	{
		b=l->data;
		brick_copy(clone_block,b);
	}

	scene_store(C->scene,0);

	return clone_block;
}
예제 #2
0
파일: sketch.c 프로젝트: BlackBoxe/minuit
void skt_msh_rectangle(float *p,float w,float h,float *color)
{
	float a[3];
	float b[3];
	float c[3];
	float d[3];

	float *vw = vnew(w,0,0);
	float *vh = vnew(0,h,0);

	vcp(a,p);
	vadd(b,a,vw);
	vadd(c,b,vh);
	vadd(d,a,vh);

	free(vw);
	free(vh);

	glColor3f(color[0],color[1],color[2]);

	glBegin(GL_POLYGON);
		glVertex3f(a[0],a[1],a[2]);
		glVertex3f(b[0],b[1],b[2]);
		glVertex3f(c[0],c[1],c[2]);
		glVertex3f(d[0],d[1],d[2]);
	glEnd();
}
예제 #3
0
TEST(SharedValueTest, ctorPtr)
{
    void* p;
    const void* cp;
    int* pi;
    const int* cpi;
    bool* pb;
    const bool* cpb;
    TestStruct* pts;
    const TestStruct* cpts;
    void* pn = NULL;
    void* pnullptr = nullptr;

    EXPECT_NO_THROW(Value v(p));
    EXPECT_NO_THROW(Value v(cp));
    EXPECT_NO_THROW(Value v(pi));
    EXPECT_NO_THROW(Value v(cpi));
    EXPECT_NO_THROW(Value v(pb));
    EXPECT_NO_THROW(Value v(cpb));
    EXPECT_NO_THROW(Value v(pts));
    EXPECT_NO_THROW(Value v(cpts));
    EXPECT_NO_THROW(Value v(pn));
    EXPECT_NO_THROW(Value v(pnullptr));
    EXPECT_NO_THROW(Value v(nullptr));
    EXPECT_NO_THROW(Value v(NULL)); // probably will be int(0) or _null(0) (bad)

    Value vp(p);
    Value vcp(cp);
    Value vpi(pi);
    Value vcpi(cpi);
    Value vpb(pb);
    Value vcpb(cpb);
    Value vpts(pts);
    Value vcpts(cpts);
    Value vpn(pn);
    Value vnullptr(nullptr);
    Value vNULL(NULL);

    EXPECT_EQ(vp.type(), typeid(const void*));
    EXPECT_EQ(vcp.type(), typeid(const void*));
    EXPECT_EQ(vpi.type(), typeid(const int*));
    EXPECT_EQ(vcpi.type(), typeid(const int*));
    EXPECT_EQ(vpb.type(), typeid(const bool*));
    EXPECT_EQ(vcpb.type(), typeid(const bool*));
    EXPECT_EQ(vpts.type(), typeid(const TestStruct*));
    EXPECT_EQ(vcpts.type(), typeid(const TestStruct*));
    EXPECT_EQ(vpn.type(), typeid(const void*));
    EXPECT_EQ(vnullptr.type(), typeid(const void*));

    EXPECT_NE(vNULL.type(), typeid(const void*));
    EXPECT_EQ(vNULL.type(), typeid(NULL));
}
예제 #4
0
파일: sketch.c 프로젝트: BlackBoxe/minuit
void skt_line_rectangle(float *p,float w,float h,int line_width,float *color)
{
	float a[3];
	float b[3];
	float c[3];
	float d[3];

	float *vw = vnew(w,0,0);
	float *vh = vnew(0,h,0);

	vcp(a,p);
	vadd(b,a,vw);
	vadd(c,b,vh);
	vadd(d,a,vh);

	skt_line_quad(a,b,c,d,line_width,color);
}
예제 #5
0
파일: block.c 프로젝트: rvba/minuit
t_block *block_dupli(t_block *block)
{
	t_context *C=ctx_get();
	scene_store(C->scene,1);

	t_node *clone_node=add_block(C,block->id.name);
	t_block *clone_block=clone_node->data;

	vcp(clone_block->pos,block->pos);

	clone_block->pos[0]+=10;
	clone_block->pos[1]+=10;

	clone_block->block_state.draw_clone_link = 1;
	t_link *l;
	t_brick *b;

	for(l=block->bricks->first;l;l=l->next)
	{
		b=l->data;
		brick_dupli(clone_block,b);
	}

	if( block->clone)
	{
		clone_block->clone = block->clone;
	}
	else
	{
		clone_block->clone = block;
	}

	t_block *block_parent = clone_block->clone;

	block_parent->clones+=1;

	scene_store(C->scene,0);

	return clone_block;
}