Refraction seems to work. Still need to do a nice scene.

This commit is contained in:
Godzil
2020-02-21 22:50:12 +00:00
parent df52cb36db
commit 3db0aaaeac
9 changed files with 274 additions and 16 deletions

View File

@@ -44,13 +44,31 @@ public:
{
ChainList *p = this->head;
if (p == nullptr) { return; }
if ((p->next == nullptr) && (p->shape == s))
{
/* First element */
this->tail = nullptr;
free(this->head);
this->head = nullptr;
this->count = 0;
return;
}
while(p->next != nullptr)
{
if (p->next->shape == s)
{
this->count --;
ChainList *found = p->next;
p->next = p->next->next;
free(p->next);
free(found);
if (p->next == NULL) { this->tail = p; }
this->count --;
return;
}
p = p->next;
@@ -64,10 +82,10 @@ public:
theNew->shape = s;
ChainList *p = this->tail;
tail = theNew;
this->tail = theNew;
if (p != nullptr) { p->next = theNew; }
else { head = theNew; } /* If the tail is empty, it mean the list IS empty. */
else { this->head = theNew; } /* If the tail is empty, it mean the list IS empty. */
this->count ++;
}