RefResult Gradient::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ) { switch (message) { case REFMSG_CHANGE: { ivalid.SetEmpty(); if (hTarget == pblock) { // see if this message came from a changing parameter in the pblock, // if so, limit rollout update to the changing item and update any active viewport texture ParamID changing_param = pblock->LastNotifyParamID(); if (hTarget != uvGen && hTarget != texout) grad_param_blk.InvalidateUI(changing_param); if (changing_param != -1) DiscardTexHandle(); } // notify our dependents that we've changed // NotifyChanged(); //DS this is redundant break; } case REFMSG_UV_SYM_CHANGE: DiscardTexHandle(); break; } return(REF_SUCCEED); }
RefResult Noise::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ) { switch (message) { case REFMSG_CHANGE: ivalid.SetEmpty(); cacheValid.SetEmpty(); if (hTarget == pblock) { // see if this message came from a changing parameter in the pblock, // if so, limit rollout update to the changing item and update any active viewport texture ParamID changing_param = pblock->LastNotifyParamID(); // if (hTarget != xyzGen && hTarget != texout ) noise_param_blk.InvalidateUI(changing_param); // notify our dependents that we've changed // NotifyChanged(); //DS this is redundant #ifdef SHOW_3DMAPS_WITH_2D if (changing_param != -1) DiscardTexHandle(); #endif } #ifdef SHOW_3DMAPS_WITH_2D else if (hTarget == xyzGen) { DiscardTexHandle(); } #endif break; } return(REF_SUCCEED); }
// This method is responsible for responding to the change notification // messages sent by the texmap dependants. RefResult Water::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ) { switch (message) { case REFMSG_CHANGE: texValidity.SetEmpty(); if (hTarget == pblock) { ParamID changing_param = pblock->LastNotifyParamID(); water_param_blk.InvalidateUI(changing_param); #ifdef SHOW_3DMAPS_WITH_2D if (changing_param != -1) DiscardTexHandle(); #endif } #ifdef SHOW_3DMAPS_WITH_2D else if (hTarget == xyzGen) { DiscardTexHandle(); } #endif // One of the texmap dependants have changed. We set our // validity interval to empty and invalidate the dialog // so it gets redrawn. // texValidity.SetEmpty(); // if (hTarget != xyzGen) { // if (paramDlg) // paramDlg->pmap->Invalidate(); // } break; /* case REFMSG_GET_PARAM_DIM: { // This returns the 'dimension' of the parameter. This is // the type and order of magnitude of the parameter. GetParamDim *gpd = (GetParamDim *)partID; switch (gpd->index) { case PB_LEN_MIN: case PB_LEN_MAX: case PB_SIZE: gpd->dim = stdWorldDim; break; case PB_AMP: case PB_NUM: case PB_PHASE: gpd->dim = defaultDim; break; case PB_COL1: case PB_COL2: gpd->dim = stdColor255Dim; break; } return REF_STOP; } case REFMSG_GET_PARAM_NAME: { // This returns the name that will appear in track view // of the parameter. GetParamName *gpn = (GetParamName *)partID; gpn->name = GetString(nameIDs[gpn->index]); return REF_STOP; } */ } return(REF_SUCCEED); }
RefResult BerconTile::NotifyRefChanged(NOTIFY_REF_CHANGED_ARGS) { switch (message) { case REFMSG_CHANGE: ivalid.SetEmpty(); if (hTarget == pblock) { ParamID changing_param = pblock->LastNotifyParamID(); BerconTile_param_blk.InvalidateUI(changing_param); if (changing_param != -1) DiscardTexHandle(); } else if (hTarget == pbXYZ) { ParamID changing_param = pbXYZ->LastNotifyParamID(); xyz_blk.InvalidateUI(changing_param); if (changing_param != -1) DiscardTexHandle(); } break; } return(REF_SUCCEED); }
// This is called as the user ends a strokes when the users has it set to always update BOOL PainterTextureSample::EndStroke() { texHandleValid.Empty(); DiscardTexHandle(); NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_CHANGE); return TRUE; }
DWORD_PTR Speckle::GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker) { if (texHandle) { if (texHandleValid.InInterval(t)) return texHandle->GetHandle(); else DiscardTexHandle(); } texHandle = thmaker.MakeHandle(GetVPDisplayDIB(t,thmaker,texHandleValid)); return texHandle->GetHandle(); }
PainterTextureSample::~PainterTextureSample() { ReleaseICustButton(iPaintButton); iPaintButton = NULL; if (pPainter) { if (pPainter->InPaintMode() ) pPainter->EndPaintSession(); } DiscardTexHandle(); }
RefResult UVtex::NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message) { switch (message) { case REFMSG_CHANGE: ivalid.SetEmpty(); if (hTarget == pblock) { // see if this message came from a changing parameter in the pblock, // if so, limit rollout update to the changing item and update any active viewport texture ParamID changing_param = pblock->LastNotifyParamID(); uvtexpb.InvalidateUI();//changing_param DiscardTexHandle(); // notify our dependents that we've changed // NotifyChanged(); //DS this is redundant } break; } return REF_SUCCEED; }
DWORD UVtex::GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker) { #endif if (texHandle) { if (texHandleValid.InInterval(t)) return texHandle->GetHandle(); else DiscardTexHandle(); } Interval v; Update(t,v); Bitmap *bm; bm = BuildBitmap(thmaker.Size()); texHandle = thmaker.CreateHandle(bm); bm->DeleteThis(); texHandleValid.SetInfinite(); int i; pblock->GetValue(uv_uvchannel, t, i, texHandleValid); pblock->GetValue(uv_rtype, t, i, texHandleValid); pblock->GetValue(uv_gtype, t, i, texHandleValid); pblock->GetValue(uv_btype, t, i, texHandleValid); pblock->GetValue(uv_rcount, t, i, texHandleValid); pblock->GetValue(uv_gcount, t, i, texHandleValid); pblock->GetValue(uv_bcount, t, i, texHandleValid); float f; pblock->GetValue(uv_tintAmount, t, f, texHandleValid); pblock->GetValue(uv_rAmount, t, f, texHandleValid); pblock->GetValue(uv_gAmount, t, f, texHandleValid); pblock->GetValue(uv_bAmount, t, f, texHandleValid); Color c; pblock->GetValue(uv_tintColor, t, c, texHandleValid); BOOL b; pblock->GetValue(uv_clampUVW, t, b, texHandleValid); return texHandle->GetHandle(); }
// This method is responsible for responding to the change notification // messages sent by the texmap dependants. RefResult Planet::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ) { switch (message) { case REFMSG_CHANGE: texValidity.SetEmpty(); if (hTarget == pblock) { ParamID changing_param = pblock->LastNotifyParamID(); // MM: 2/99, If the seed changed update the noise table if (changing_param == planet_seed) { pblock->GetValue(planet_seed, 0, seed, texValidity); init_noise(seed); } planet_param_blk.InvalidateUI(changing_param); #ifdef SHOW_3DMAPS_WITH_2D if (changing_param != -1) DiscardTexHandle(); #endif } #ifdef SHOW_3DMAPS_WITH_2D else if (hTarget == xyzGen) { DiscardTexHandle(); } #endif // One of the texmap dependants have changed. We set our // validity interval to empty and invalidate the dialog // so it gets redrawn. // texValidity.SetEmpty(); // if (hTarget == pblock) { // if (paramDlg) // paramDlg->pmap->Invalidate(); // } break; /* case REFMSG_GET_PARAM_DIM: { // This returns the 'dimension' of the parameter. This is // the type and order of magnitude of the parameter. GetParamDim *gpd = (GetParamDim *)partID; switch (gpd->index) { case PB_PERCENT: gpd->dim = stdPercentDim; break; case PB_SIZE: gpd->dim = stdWorldDim; break; case PB_ISLAND: case PB_SEED: gpd->dim = defaultDim; break; case PB_COL1: case PB_COL2: case PB_COL3: case PB_COL4: case PB_COL5: case PB_COL6: case PB_COL7: case PB_COL8: gpd->dim = stdColor255Dim; break; } return REF_STOP; } case REFMSG_GET_PARAM_NAME: { // This returns the name that will appear in track view // of the parameter. GetParamName *gpn = (GetParamName *)partID; gpn->name = GetString(nameIDs[gpn->index]); return REF_STOP; } */ } return(REF_SUCCEED); }
BerconNoise::~BerconNoise() { DiscardTexHandle(); }
void PainterTextureSample::ActivateTexDisplay(BOOL onoff) { if (!onoff) DiscardTexHandle(); }
BerconTile::~BerconTile() { DiscardTexHandle(); }
void Gradient::ActivateTexDisplay(BOOL onoff) { if (!onoff) DiscardTexHandle(); }
//This is called as the user strokes across the mesh or screen with the mouse down BOOL PainterTextureSample::PaintStroke( BOOL hit, IPoint2 mousePos, Point3 worldPoint, Point3 worldNormal, Point3 localPoint, Point3 localNormal, Point3 bary, int index, BOOL shift, BOOL ctrl, BOOL alt, float radius, float str, float pressure, INode *node, BOOL mirrorOn, Point3 worldMirrorPoint, Point3 worldMirrorNormal, Point3 localMirrorPoint, Point3 localMirrorNormal ) { static IPoint2 lastPoint; if (hit) { //loop through 500 random points along the stroke BOOL airBrushMode = FALSE; if (airBrushMode) { int ct = radius; if (lagRate > 0) { Point2 p1; p1.x = mousePos.x; p1.y = mousePos.y; Point2 p2; p2.x = lastPoint.x; p2.y = lastPoint.y; float dist = Length(p2-p1); ct = dist * radius; } else ct = radius * 100.0f; for (int i =0; i < ct; i++) { Point3 dummyPointWorldPos; Point3 dummyPointWorldNormal; Point3 dummyPointLocalPos; Point3 dummyPointLocalNormal; Point3 dummyPointWorldPosM; Point3 dummyPointWorldNormalM; Point3 dummyPointLocalPosM; Point3 dummyPointLocalNormalM; Point3 bary; int index; float str; INode *node = NULL; BOOL mirror; if (pPainter->RandomHitAlongStroke(dummyPointWorldPos, dummyPointWorldNormal, dummyPointLocalPos, dummyPointLocalNormal, bary, index, str, node, mirror, dummyPointWorldPosM, dummyPointWorldNormalM, dummyPointLocalPosM, dummyPointLocalNormalM,lagCount)) { //get the hit point bary if ((index >=0) && (index < uvwFaces.Count())) { //convert to UVW Point3 a = uvwPoints[uvwFaces[index].t[0]]; Point3 b = uvwPoints[uvwFaces[index].t[1]]; Point3 c = uvwPoints[uvwFaces[index].t[2]]; Point3 uvw = a * bary.x + b * bary.y + c * bary.z; //draw in the bitmap if (bm) { BMM_Color_64 basebit; int x = uvw.x*width; int y = (1.0f-uvw.y)*width; float baseAlpha, incAlpha; incAlpha = str; baseAlpha = 1.0f - str; bm->GetPixels(x,y,1,&basebit); basebit.r = (basebit.r * baseAlpha) + (bit.r * incAlpha); basebit.g = (basebit.g * baseAlpha) + (bit.g * incAlpha); basebit.b = (basebit.b * baseAlpha) + (bit.b * incAlpha); bm->PutPixels(x,y,1,&basebit); } } } } } else { int count = 0; float *str = pPainter->RetrievePointGatherStr(node, count); for (int i =0; i < count; i++) { if (*str > 0.0f) { Point3 uvw = uvwList[i]; //draw in the bitmap if (bm) { BMM_Color_64 basebit; int x = uvw.x*width; int y = (1.0f-uvw.y)*width; float baseAlpha, incAlpha; incAlpha = *str; baseAlpha = 1.0f - *str; bm->GetPixels(x,y,1,&basebit); basebit.r = (basebit.r * baseAlpha) + (bit.r * incAlpha); basebit.g = (basebit.g * baseAlpha) + (bit.g * incAlpha); basebit.b = (basebit.b * baseAlpha) + (bit.b * incAlpha); bm->PutPixels(x,y,1,&basebit); } } str++; } } lagCount++; if ((lagRate == 0) || ((lagCount%lagRate) == 0)) { texHandleValid.Empty(); DiscardTexHandle(); } lastPoint = mousePos; // NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_CHANGE); } return TRUE; }
RefResult CellTex::NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message) { switch (message) { case REFMSG_CHANGE: ivalid.SetEmpty(); if (hTarget == pblock) { ParamID changing_param = pblock->LastNotifyParamID(); cellular_param_blk.InvalidateUI(changing_param); #ifdef SHOW_3DMAPS_WITH_2D if (changing_param != -1) DiscardTexHandle(); #endif } #ifdef SHOW_3DMAPS_WITH_2D else if (hTarget == xyzGen) { DiscardTexHandle(); } #endif break; /* case REFMSG_GET_PARAM_DIM: { GetParamDim *gpd = (GetParamDim*)partID; switch (gpd->index) { case PB_CELLCOL: case PB_DIVCOL1: case PB_DIVCOL2: gpd->dim = stdColor255Dim; break; case PB_SIZE: gpd->dim = stdWorldDim; break; default: gpd->dim = defaultDim; break; } return REF_STOP; } case REFMSG_GET_PARAM_NAME: { GetParamName *gpn = (GetParamName*)partID; switch (gpn->index) { case PB_CELLCOL: gpn->name = GetString(IDS_RB_CELLCOLOR); break; case PB_DIVCOL1: gpn->name = GetString(IDS_RB_DIVCOLOR1); break; case PB_DIVCOL2: gpn->name = GetString(IDS_RB_DIVCOLOR2); break; case PB_VAR: gpn->name = GetString(IDS_RB_VARIATION); break; case PB_SIZE: gpn->name = GetString(IDS_RB_SIZE); break; case PB_SPREAD: gpn->name = GetString(IDS_RB_SPREAD); break; case PB_LOW: gpn->name = GetString(IDS_RB_LOW); break; case PB_MID: gpn->name = GetString(IDS_RB_MID); break; case PB_HIGH: gpn->name = GetString(IDS_RB_HIGH); break; case PB_TYPE: gpn->name = GetString(IDS_RB_TYPE); break; case PB_FRACT: gpn->name = GetString(IDS_RB_FRACTAL); break; case PB_ITER: gpn->name = GetString(IDS_RB_ITERATIONS); break; case PB_ROUGH: gpn->name = GetString(IDS_RB_ROUGHNESS); break; case PB_SMOOTH: gpn->name = GetString(IDS_RB_BUMPSMOOTHING); break; default: gpn->name = GetString(IDS_RB_PARAMETER); break; } return REF_STOP; } */ } return REF_SUCCEED; }
void ActivateTexDisplay(BOOL onoff) { if (!onoff) DiscardTexHandle(); }
BerconGradient::~BerconGradient() { if (gradient) delete gradient; DiscardTexHandle(); }
~Noise() { #ifdef SHOW_3DMAPS_WITH_2D DiscardTexHandle(); #endif DeleteCriticalSection(&csect); }
UVtex::~UVtex() { DiscardTexHandle(); DeleteCriticalSection(&csect); }
~CellTex() { DeleteCriticalSection(&csect); #ifdef SHOW_3DMAPS_WITH_2D DiscardTexHandle(); #endif }
~Speckle() { #ifdef SHOW_3DMAPS_WITH_2D DiscardTexHandle(); #endif }
~Gradient() { DiscardTexHandle(); }
// This is called as the user ends a strokes when the users has it set to update on mouse up only // the canvas gets a list of all points, normals etc instead of one at a time // int ct - the number of elements in the following arrays // <...> see paintstroke() these are identical except they are arrays of values BOOL PainterTextureSample::EndStroke(int ct, BOOL *hit, IPoint2 *mousePos, Point3 *worldPoint, Point3 *worldNormal, Point3 *localPoint, Point3 *localNormal, Point3 *bary, int *index, BOOL *shift, BOOL *ctrl, BOOL *alt, float *radius, float *str, float *pressure, INode **node, BOOL mirrorOn, Point3 *worldMirrorPoint, Point3 *worldMirrorNormal, Point3 *localMirrorPoint, Point3 *localMirrorNormal) { //loop through 500 random points along the stroke BOOL airBrushMode = FALSE; if (airBrushMode) { int totalCount = ct * 100; for (int i =0; i < totalCount; i++) { Point3 dummyPointWorldPos; Point3 dummyPointWorldNormal; Point3 dummyPointLocalPos; Point3 dummyPointLocalNormal; Point3 dummyPointWorldPosM; Point3 dummyPointWorldNormalM; Point3 dummyPointLocalPosM; Point3 dummyPointLocalNormalM; Point3 bary; int index; float str; INode *node = NULL; BOOL mirror; if (pPainter->RandomHitAlongStroke(dummyPointWorldPos, dummyPointWorldNormal, dummyPointLocalPos, dummyPointLocalNormal, bary, index, str, node, mirror, dummyPointWorldPosM, dummyPointWorldNormalM, dummyPointLocalPosM, dummyPointLocalNormalM,-1)) { //get the hit point bary if ((index >=0) && (index < uvwFaces.Count())) { //convert to UVW Point3 a = uvwPoints[uvwFaces[index].t[0]]; Point3 b = uvwPoints[uvwFaces[index].t[1]]; Point3 c = uvwPoints[uvwFaces[index].t[2]]; Point3 uvw = a * bary.x + b * bary.y + c * bary.z; //draw in the bitmap if (bm) { BMM_Color_64 basebit; int x = uvw.x*width; int y = (1.0f-uvw.y)*width; float baseAlpha, incAlpha; incAlpha = str; baseAlpha = 1.0f - str; bm->GetPixels(x,y,1,&basebit); basebit.r = (basebit.r * baseAlpha) + (bit.r * incAlpha); basebit.g = (basebit.g * baseAlpha) + (bit.g * incAlpha); basebit.b = (basebit.b * baseAlpha) + (bit.b * incAlpha); bm->PutPixels(x,y,1,&basebit); } } } } } else { int count = 0; float *str = pPainter->RetrievePointGatherStr(this->node, count); for (int i =0; i < count; i++) { if (*str > 0.0f) { Point3 uvw = uvwList[i]; //draw in the bitmap if (bm) { BMM_Color_64 basebit; int x = uvw.x*width; int y = (1.0f-uvw.y)*width; float baseAlpha, incAlpha; incAlpha = *str; baseAlpha = 1.0f - *str; bm->GetPixels(x,y,1,&basebit); basebit.r = (basebit.r * baseAlpha) + (bit.r * incAlpha); basebit.g = (basebit.g * baseAlpha) + (bit.g * incAlpha); basebit.b = (basebit.b * baseAlpha) + (bit.b * incAlpha); bm->PutPixels(x,y,1,&basebit); } } str++; } } texHandleValid.Empty(); DiscardTexHandle(); NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_CHANGE); return TRUE; }
BerconWood::~BerconWood() { DiscardTexHandle(); }